Skip to content

[Form] add guess pattern #4077

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 23, 2012
Merged

[Form] add guess pattern #4077

merged 1 commit into from
Apr 23, 2012

Conversation

ruian
Copy link
Contributor

@ruian ruian commented Apr 23, 2012

Bug fix: no
Feature addition: yes
Backwards compatibility break: no
Symfony2 tests pass: yes
Fixes the following tickets: #3766
Todo: -

Due to some trouble when rebase my previous PR i open a new one with Master merged
Refs PR: #3927

@@ -306,7 +306,7 @@ public function createNamedBuilder($type, $name, $data = null, array $options =
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should revert permission change.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@fabpot
Copy link
Member

fabpot commented Apr 23, 2012

@vicb @bschussek ok for you?

@webmozart
Copy link
Contributor

please do also rephrase the commit message to something clearer, like

[Form] added method `guessPattern` to FormTypeGuesserInterface

@webmozart
Copy link
Contributor

Otherwise this looks good :)

@ruian
Copy link
Contributor Author

ruian commented Apr 23, 2012

every changes done

fabpot added a commit that referenced this pull request Apr 23, 2012
Commits
-------

f7200e4 [Form] added method `guessPattern` to FormTypeGuesserInterface

Discussion
----------

[Form] add guess pattern

Bug fix: no
Feature addition: yes
Backwards compatibility break: no
Symfony2 tests pass: yes
Fixes the following tickets: #3766
Todo: -

Due to some trouble when rebase my previous PR i open a new one with Master merged
Refs PR: #3927

---------------------------------------------------------------------------

by fabpot at 2012-04-23T10:25:57Z

@vicb @bschussek ok for you?

---------------------------------------------------------------------------

by bschussek at 2012-04-23T10:26:51Z

please do also rephrase the commit message to something clearer, like

    [Form] added method `guessPattern` to FormTypeGuesserInterface

---------------------------------------------------------------------------

by bschussek at 2012-04-23T10:27:35Z

Otherwise this looks good :)

---------------------------------------------------------------------------

by ruian at 2012-04-23T10:29:18Z

every changes done
@fabpot fabpot merged commit f7200e4 into symfony:master Apr 23, 2012
* - If this value is a float type, this is wrong so you guess null with MEDIUM_CONFIDENCE to override the previous guess.
* Example:
* You want a float greater than 5, 4.512313 is not valid but length(4.512314) > length(5)
* @link https://github.com/symfony/symfony/pull/3927
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this description is very abstruse and the link doesn't belong here

@marcospassos
Copy link

Thanks!

fabpot added a commit that referenced this pull request Apr 23, 2012
Commits
-------

d9e142b [Form] Restored and deprecated method `guessMinLength` in FormTypeGuesser

Discussion
----------

[Form] Restored and deprecated method `guessMinLength` in FormTypeGuesser

Bug fix: yes
Feature addition: no
Backwards compatibility break: no
Symfony2 tests pass: yes
Fixes the following tickets: -
Todo: -

![Travis Build Status](https://secure.travis-ci.org/bschussek/symfony.png?branch=issue4077)

This is a follow-up PR to #4077 (see comments in #3927 for reference).
fabpot added a commit that referenced this pull request Jul 4, 2012
Commits
-------

6f9eda9 [Form][Validator] Fixed generation of HTML5 pattern attribute based on Assert\Regex to remove delimiters.

Discussion
----------

[Form][Validator] Fixed generation of HTML5 pattern attribute based on Assert\Regex by removing delimiters or using a new option: htmlPattern.

Hopefully, this time is the good one…

* Fixes: [#3766, #4077, #4513, #4520, #4521]
* Bug fix: yes
* Feature addition: yes
* BC break: no
* Symfony2 tests pass: yes

In Issue #3766, it was asked that Assert\Regex generates HTML5 pattern attribute.
It was done in PR #4077, but the generated Regex is in delimited format which is not supported by HTML5.

Hence, `/[a-z]+/` would be converted to `[a-z]+`.
If flags are specified like in `/[a-z]+/i`, it cannot be converted and pattern validation will be disabled client-side. If is however now possible, using a new option, `htmlPattern`, to specify the pattern you want to be used.

Example:

```php
<?php
/**
 * @Assert\Regex(pattern="/^[0-9]+[a-z]*$/i", htmlPattern="^[0-9]+[a-zA-Z]*$")
 */
private $civic_number;
```

**Note**: [Documentation](http://symfony.com/doc/current/reference/constraints/Regex.html) should be updated accordingly.

---------------------------------------------------------------------------

by lavoiesl at 2012-06-08T15:45:17Z

God, I just found out you can "add more commits to this pull request by pushing to the master branch on lavoiesl/symfony"…

---------------------------------------------------------------------------

by travisbot at 2012-06-08T15:50:31Z

This pull request [passes](http://travis-ci.org/symfony/symfony/builds/1568634) (merged 2d767b41 into b84b46b).

---------------------------------------------------------------------------

by petajaros at 2012-07-04T14:23:16Z

Anything new about this issue?

---------------------------------------------------------------------------

by lavoiesl at 2012-07-04T16:25:43Z

Alright, tests are passing using `phpunit -c phpunit.xml.dist --filter 'RegexValidatorTest'`. @travisbot reports errors because he can’t even start the tests due to dependencies, which is not related

---------------------------------------------------------------------------

by vicb at 2012-07-04T16:31:13Z

It should be ready to merge when you have taken the last comments into account. thanks.

---------------------------------------------------------------------------

by lavoiesl at 2012-07-04T16:39:05Z

So it seems this PR will finally pass, thanks a lot.

---------------------------------------------------------------------------

by vicb at 2012-07-04T17:03:35Z

Thank you for this PR and the changes.

---------------------------------------------------------------------------

by fabpot at 2012-07-04T17:10:20Z

@lavoiesl Can you squash your commits before I merge? Thanks.

---------------------------------------------------------------------------

by lavoiesl at 2012-07-04T17:25:18Z

There. I also left trace of some commits I did.

Thanks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature Form Good first issue Ideal for your first contribution! (some Symfony experience may be required)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants