Skip to content

Commit 2066fc0

Browse files
committed
[Validator] do not treat payload as callback
1 parent bd6d9bb commit 2066fc0

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
public function validateMe(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(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)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy