-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Improved the example about Choice constraint callback #10679
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
Conversation
Maybe it works only if they are in the same namespace? |
@@ -222,7 +222,7 @@ you can pass the class name and the method as an array. | |||
class Author | |||
{ | |||
/** | |||
* @Assert\Choice(callback={"Util", "getGenres"}) | |||
* @Assert\Choice(callback={"AppBundle\Entity\Genre", "getGenres"}) |
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 can also be Genre::class
but I guess it is more clear this way
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.
https://3v4l.org/gY4gN even if it is in the same namespace it still returns false, this seems like a valid change.
Marko, thanks a lot for reviewing this and for creating the sample code! |
…aviereguiluz) This PR was merged into the 2.8 branch. Discussion ---------- Improved the example about Choice constraint callback I don't know if this is 100% correct, but in a real Symfony project, the `callback` without the FQCN didn't work (at least when using the PHP annotations). Commits ------- dece243 Improved the example about Choice constraint callback
👍 |
I think someone took |
I don't know if this is 100% correct, but in a real Symfony project, the
callback
without the FQCN didn't work (at least when using the PHP annotations).