Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions reference/constraints/Callback.rst
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ Configuration
/**
* @Assert\Callback
*/
public function validate(ExecutionContextInterface $context)
public function validate(ExecutionContextInterface $context, $payload)
{
// ...
}
Expand Down Expand Up @@ -103,7 +103,7 @@ field those errors should be attributed::
// ...
private $firstName;

public function validate(ExecutionContextInterface $context)
public function validate(ExecutionContextInterface $context, $payload)
{
// somehow you have an array of "fake names"
$fakeNames = array(/* ... */);
Expand All @@ -123,7 +123,7 @@ Static Callbacks
You can also use the constraint with static methods. Since static methods don't
have access to the object instance, they receive the object as the first argument::

public static function validate($object, ExecutionContextInterface $context)
public static function validate($object, ExecutionContextInterface $context, $payload)
{
// somehow you have an array of "fake names"
$fakeNames = array(/* ... */);
Expand Down Expand Up @@ -151,7 +151,7 @@ Suppose your validation function is ``Vendor\Package\Validator::validate()``::

class Validator
{
public static function validate($object, ExecutionContextInterface $context)
public static function validate($object, ExecutionContextInterface $context, $payload)
{
// ...
}
Expand Down Expand Up @@ -240,7 +240,7 @@ constructor of the Callback constraint::
{
public static function loadValidatorMetadata(ClassMetadata $metadata)
{
$callback = function ($object, ExecutionContextInterface $context) {
$callback = function ($object, ExecutionContextInterface $context, $payload) {
// ...
};

Expand Down