Skip to content
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

Accessing the paylod in the Callback constraint #6185

Closed
xabbuh opened this issue Jan 26, 2016 · 4 comments
Closed

Accessing the paylod in the Callback constraint #6185

xabbuh opened this issue Jan 26, 2016 · 4 comments
Labels
actionable Clear and specific issues ready for anyone to take them. good first issue Ideal for your first contribution! (some Symfony experience may be required) Hack Day hasPR A Pull Request has already been submitted for this issue. Validator
Milestone

Comments

@xabbuh
Copy link
Member

xabbuh commented Jan 26, 2016

Since Symfony 2.6 it is possible to pass custom payload data to the constraint validators. However, it was not possible to access this payload in the Callback constraint. With Symfony 3.1 this will now be possible as the payload is passed as an additional argument to the callback (see symfony/symfony#16909).

@xabbuh xabbuh added good first issue Ideal for your first contribution! (some Symfony experience may be required) actionable Clear and specific issues ready for anyone to take them. Validator labels Jan 26, 2016
@xabbuh xabbuh added this to the 3.1 milestone Jan 26, 2016
@wouterj
Copy link
Member

wouterj commented May 21, 2016

This new parameter to the callback should be documented in http://symfony.com/doc/current/reference/constraints/Callback.html (at least, all examples should be updated to have a $payload parameter as last parameter)

@jorgelbg
Copy link
Contributor

The payload option is documented on http://symfony.com/doc/current/reference/constraints/Callback.html, but the examples indeed are not taking this parameter. If it's ok I'll try to update the examples.

@jorgelbg
Copy link
Contributor

I think it would be a great addition at least one example that actually uses the $payload parameter. Any thoughts?

@xabbuh xabbuh added the hasPR A Pull Request has already been submitted for this issue. label May 21, 2016
wouterj added a commit that referenced this issue May 21, 2016
…jorgelbg)

This PR was merged into the 3.1 branch.

Discussion
----------

Adding the payload parameter to the callback examples

Updating the examples in http://symfony.com/doc/current/reference/constraints/Callback.html to show the existence of the `$payload` parameter, although at the moment none of the examples makes use of this parameter.

| Q             | A
| ------------- | ---
| Doc fix?      | yes
| New docs?     | no
| Applies to    | 3.1,3.2
| Fixed tickets | #6185

Commits
-------

b1e586b Adding the payload parameter to the callback examples
@wouterj
Copy link
Member

wouterj commented May 21, 2016

@jorgelbg hmm, I can't come up with a nice example as well... For now, I have merged #6593 and you can create a new PR as soon as we find a nice example.

@wouterj wouterj closed this as completed Jul 8, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
actionable Clear and specific issues ready for anyone to take them. good first issue Ideal for your first contribution! (some Symfony experience may be required) Hack Day hasPR A Pull Request has already been submitted for this issue. Validator
Projects
None yet
Development

No branches or pull requests

3 participants