Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork5.3k
[Validator] Explained how to use array constant in annotation#10810
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
Uh oh!
There was an error while loading.Please reload this page.
Conversation
HeahDude left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Thank you very much for this contribution!
Uh oh!
There was an error while loading.Please reload this page.
nikophil commentedDec 27, 2018
Hi@HeahDude i've wondered if this would need a |
a810dae to83a2304Comparereference/constraints/Choice.rst Outdated
| Supplying the Choices from an Array Constant | ||
| -------------------------------------------- | ||
| You can also directly provide an array constant to the ``choices`` option in the annotation:: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
- array constant+ constant containing an array
sounds a bit better
Uh oh!
There was an error while loading.Please reload this page.
reference/constraints/Choice.rst Outdated
| class Author | ||
| { | ||
| const GENRES = ['fiction', 'non-fiction']; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
I would prefer sth likeaction andcomedy
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
yep, i agree, but i've chosen these one for the coherence with the example above
would you mind that i change the other example as well ?
reference/constraints/Choice.rst Outdated
| ..note:: | ||
| If the constant is stored in a different class, you can pass the fully qualified class name |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
s/stored/defined/
reference/constraints/Choice.rst Outdated
| ..note:: | ||
| If the constant is stored in a different class, you can pass the fully qualified class name | ||
| of the class or import this class by adding it to the "use" list. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
This line is not needed
OskarStark commentedDec 27, 2018
Thank you for your contribution 👍 |
83a2304 to3f0ad71Comparereference/constraints/Choice.rst Outdated
| ..warning:: | ||
| Notice that the constant in the option is used without quotes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
| Notice that the constant in the option is used without quotes. | |
| The constant in the option is used without quotes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
👍
3f0ad71 to9b23462Comparereference/constraints/Choice.rst Outdated
| } | ||
| } | ||
| Supplying the Choices from an Array Constant |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
array constant in lower case is better i think, wdyt?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
yes you're right
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
actually i've wrote like this, to be consistent with the title above which isSupplying the Choices with a Callback Function
reference/constraints/Choice.rst Outdated
| ..warning:: | ||
| The constant in the option is used without quotes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
what about both inside note instead of warning? warning can be misunderstood
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
do you mean in thesame note or two different notes ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
do you mean both inside thesame note ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
the same i think
xabbuh commentedJan 11, 2019
I wonder if it would not be easier to expand the code example that we have in the "Basic usage" section to also contain choices coming from a constant and adding an inline comment there. |
OskarStark commentedFeb 18, 2019
nikophil commentedFeb 19, 2019
hi@OskarStark sorry, i've forgotten this one, i was thinking it was merged. here is some update. |
javiereguiluz commentedMar 7, 2019
Nicolas, thanks for this contribution ... and sorry for the late merge! |
…ation (nikophil)This PR was squashed before being merged into the 3.4 branch (closes#10810).Discussion----------[Validator] Explained how to use array constant in annotationHi,few days ago i tried to add a new feature to the `choice` validator constraint, by adding a new `choicesFromConstant` option.symfony/symfony#29658But then, i realized this was already supported.I think this should be documented, as i think a lot of people don't know this feature.thanks.Commits-------7774aab [Validator] Explained how to use array constant in annotation
Hi,
few days ago i tried to add a new feature to the
choicevalidator constraint, by adding a newchoicesFromConstantoption.symfony/symfony#29658
But then, i realized this was already supported.
I think this should be documented, as i think a lot of people don't know this feature.
thanks.