Skip to content

Commit ae0c7a2

Browse files
committed
[Validator] do not treat payload as callback
1 parent f1450f3 commit ae0c7a2

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

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 {

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
public function validateMe(ExecutionContextInterface $context)
9191
{

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(new ConstraintA());
5555
$expected->addConstraint(new Callback(array('Symfony\Component\Validator\Tests\Fixtures\CallbackClass', 'callback')));
56-
$expected->addConstraint(new Callback('validateMe'));
56+
$expected->addConstraint(new Callback(array('callback' => 'validateMe', 'payload' => 'foo')));
5757
$expected->addConstraint(new Callback('validateMeStatic'));
5858
$expected->addPropertyConstraint('firstName', new NotNull());
5959
$expected->addPropertyConstraint('firstName', new Range(array('min' => 3)));
@@ -123,7 +123,7 @@ public function testLoadClassMetadataAndMerge()
123123
$expected->setGroupSequence(array('Foo', 'Entity'));
124124
$expected->addConstraint(new ConstraintA());
125125
$expected->addConstraint(new Callback(array('Symfony\Component\Validator\Tests\Fixtures\CallbackClass', 'callback')));
126-
$expected->addConstraint(new Callback('validateMe'));
126+
$expected->addConstraint(new Callback(array('callback' => 'validateMe', 'payload' => 'foo')));
127127
$expected->addConstraint(new Callback('validateMeStatic'));
128128
$expected->addPropertyConstraint('firstName', new NotNull());
129129
$expected->addPropertyConstraint('firstName', new Range(array('min' => 3)));

0 commit comments

Comments
 (0)