Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[2.2][Validator] add support of arrays and Countables to Size Validator.#3918

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Conversation

makasim
Copy link
Contributor

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

@makasim
Copy link
ContributorAuthor

@bschussek Ithink that the constraintinvalidMessage could be confusing. I dont find a better solution. Could you help?

@vicb
Copy link
Contributor

May be the currentSize validator should be renamed asRange, @bschussek ? (see also#3893)

fabpot added a commit that referenced this pull requestMay 16, 2012
Commits-------3a5e84f [Validator] Add CollectionSize constraintDiscussion----------[Validator] Add CollectionSize constraintBug fix: noFeature addition: yesBackwards compatibility break: noSymfony2 tests pass: yesFixes the following tickets: -Todo: -I will also send a PR to the documentation as soon as this one is accepted.---------------------------------------------------------------------------by bschussek at 2012-04-29T08:24:28Z-1I dislike the rising amount of very specific constraints in the core. Can't we add this to Size?---------------------------------------------------------------------------by vicb at 2012-04-29T09:01:39Z@bschussek#3918 implements what you propose but then the messages are not valid any more:```php<?php    public $minMessage = 'This value should be {{ limit }} or more';    public $maxMessage = 'This value should be {{ limit }} or less';    public $invalidMessage = 'This value should be a valid number';```I can imagine 2 solutions:- adding some more message,- rename the `Size` constraint to `Range` and create a new `Size` constraint for arrays / countables.What do you think ?---------------------------------------------------------------------------by bschussek at 2012-04-29T09:27:53ZI'd prefer the second solution and merge `Size` with `SizeLength` as well.---------------------------------------------------------------------------by vicb at 2012-04-29T09:34:50Z@bschussek It would make sense.@makasim@Herzult any one of you would like to contribute this (i.e. rename the current Size to Range and create a new Size supporting arrays / countables / strings) ?---------------------------------------------------------------------------by Herzult at 2012-04-29T14:31:12ZYep, I'm on it.---------------------------------------------------------------------------by stof at 2012-04-29T15:22:44Z@Herzult could you take the other comment into account and merge SizeLength into you Size ?---------------------------------------------------------------------------by vicb at 2012-04-29T15:33:05ZThe guessers should also be modified (it might also affect the ODM which is in an other repo, if so it would be good to sync the changes).---------------------------------------------------------------------------by Herzult at 2012-04-29T16:38:19Z@stof the problem merging SizeLength into Size is that they don't have the same required options & messages.---------------------------------------------------------------------------by Herzult at 2012-04-29T16:47:40ZAnd what about renaming Range to Interval and SizeLength to IntervalLength?---------------------------------------------------------------------------by stof at 2012-04-29T16:54:38ZWell, SizeLength is about matching the length of a string currently. Nothing related to intervals---------------------------------------------------------------------------by Herzult at 2012-04-29T17:29:40ZHere are the current names: * **Size** for collection (countable) size * **Range** for numbers * **SizeLength** for stringsMerging **SizeLength** into **Size** is maybe not appropriate because collections and strings are different things. It'll be hard to find messages that fit both collections and strings. Maybe we had better to find a better name for both. What do you think?About the ValidatorTypeGuesser, I'll update it as soon as we know ow to name the constraints.---------------------------------------------------------------------------by vicb at 2012-04-29T17:43:01ZSize is a good name for both strings and "collections", could we have two sets of strings and select according to the type ?---------------------------------------------------------------------------by Herzult at 2012-04-29T22:39:55ZI tried to merge them together, what do you think?---------------------------------------------------------------------------by vicb at 2012-04-30T06:52:37ZI think your changes are great, may be @bschussek has more feedback. The ValidatorTypeGuesser and the translation are yet to be updated.---------------------------------------------------------------------------by hhamon at 2012-05-01T12:32:28ZAm I missing something or `SizeLength` for strings is a duplicate for `MinLength` and `MaxLength` constraints?---------------------------------------------------------------------------by Herzult at 2012-05-02T13:29:36ZYep, that's true. But the only link between this PR and the SizeLength constraint is that I merged it to the one I introduced.---------------------------------------------------------------------------by Herzult at 2012-05-07T07:48:01Z@bschussek what do you think?---------------------------------------------------------------------------by vicb at 2012-05-10T19:51:26Z@Herzult this PR looks good to me, could you update the changelog and update guides, try to factorize the code and squash the commits ? Thanks.---------------------------------------------------------------------------by travisbot at 2012-05-11T15:42:35ZThis pull request [passes](http://travis-ci.org/symfony/symfony/builds/1306112) (merged 8d8e6443 into4ac3bdd).---------------------------------------------------------------------------by vicb at 2012-05-11T21:42:21Z* could#4259 be helpful ?* please squash the commits.* please create a PR / issue on [symfony-docs](https://github.com/symfony/symfony-docs)thanks for the updates.---------------------------------------------------------------------------by travisbot at 2012-05-13T18:38:18ZThis pull request [fails](http://travis-ci.org/symfony/symfony/builds/1321123) (merged eeda9044 into4ac3bdd).---------------------------------------------------------------------------by travisbot at 2012-05-13T18:45:12ZThis pull request [passes](http://travis-ci.org/symfony/symfony/builds/1321146) (merged 491ca19a into8b54eb5).---------------------------------------------------------------------------by travisbot at 2012-05-14T11:29:39ZThis pull request [passes](http://travis-ci.org/symfony/symfony/builds/1326110) (merged 44865024 into8b54eb5).---------------------------------------------------------------------------by vicb at 2012-05-14T11:49:37Z@Herzult what about plural translations ?---------------------------------------------------------------------------by travisbot at 2012-05-14T16:52:37ZThis pull request [passes](http://travis-ci.org/symfony/symfony/builds/1328677) (merged 93480f95 into46ffbd5).---------------------------------------------------------------------------by travisbot at 2012-05-14T17:03:13ZThis pull request [passes](http://travis-ci.org/symfony/symfony/builds/1328705) (merged 326c3b81 into46ffbd5).---------------------------------------------------------------------------by vicb at 2012-05-14T20:19:18Zthanks for the updates, this PR looks fine to me. @bschussek ?---------------------------------------------------------------------------by vicb at 2012-05-16T06:45:51Z@Herzult can you squash your commits ?---------------------------------------------------------------------------by travisbot at 2012-05-16T11:20:44ZThis pull request [passes](http://travis-ci.org/symfony/symfony/builds/1344811) (merged3a5e84f into58b6ef2).
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers
No reviews
Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

2 participants
@makasim@vicb

[8]ページ先頭

©2009-2025 Movatter.jp