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

Commit3c1738a

Browse files
committed
bug#18298 [Validator] do not treat payload as callback (xabbuh)
This PR was merged into the 2.7 branch.Discussion----------[Validator] do not treat payload as callback| Q | A| ------------- | ---| Branch? | 2.7| Bug fix? | yes| New feature? | no| BC breaks? | no| Deprecations? | no| Tests pass? | yes| Fixed tickets || License | MIT| Doc PR |seehttp://stackoverflow.com/a/36140305/2289865Commits-------2066fc0 [Validator] do not treat payload as callback
2 parents831de7a +2066fc0 commit3c1738a

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

‎src/Symfony/Component/Validator/Constraints/Callback.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public function __construct($options = null)
4949
@trigger_error('The "methods" option of the'.__CLASS__.' class is deprecated since version 2.4 and will be removed in 3.0. Use the "callback" option instead.',E_USER_DEPRECATED);
5050
}
5151

52-
if (is_array($options) && !isset($options['callback']) && !isset($options['methods']) && !isset($options['groups'])) {
52+
if (is_array($options) && !isset($options['callback']) && !isset($options['methods']) && !isset($options['groups']) && !isset($options['payload'])) {
5353
if (is_callable($options) || !$options) {
5454
$options =array('callback' =>$options);
5555
}else {

‎src/Symfony/Component/Validator/Tests/Fixtures/Entity.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ public function getData()
8585
}
8686

8787
/**
88-
* @Assert\Callback
88+
* @Assert\Callback(payload="foo")
8989
*/
9090
publicfunctionvalidateMe(ExecutionContextInterface$context)
9191
{

‎src/Symfony/Component/Validator/Tests/Mapping/Loader/AnnotationLoaderTest.php‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public function testLoadClassMetadata()
5353
$expected->setGroupSequence(array('Foo','Entity'));
5454
$expected->addConstraint(newConstraintA());
5555
$expected->addConstraint(newCallback(array('Symfony\Component\Validator\Tests\Fixtures\CallbackClass','callback')));
56-
$expected->addConstraint(newCallback('validateMe'));
56+
$expected->addConstraint(newCallback(array('callback' =>'validateMe','payload' =>'foo')));
5757
$expected->addConstraint(newCallback('validateMeStatic'));
5858
$expected->addPropertyConstraint('firstName',newNotNull());
5959
$expected->addPropertyConstraint('firstName',newRange(array('min' =>3)));
@@ -123,7 +123,7 @@ public function testLoadClassMetadataAndMerge()
123123
$expected->setGroupSequence(array('Foo','Entity'));
124124
$expected->addConstraint(newConstraintA());
125125
$expected->addConstraint(newCallback(array('Symfony\Component\Validator\Tests\Fixtures\CallbackClass','callback')));
126-
$expected->addConstraint(newCallback('validateMe'));
126+
$expected->addConstraint(newCallback(array('callback' =>'validateMe','payload' =>'foo')));
127127
$expected->addConstraint(newCallback('validateMeStatic'));
128128
$expected->addPropertyConstraint('firstName',newNotNull());
129129
$expected->addPropertyConstraint('firstName',newRange(array('min' =>3)));

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp