Skip to content

[Hackday] [2.7] Add a deprecation note about the methods option of the Callback constraint #12672

@javiereguiluz

Description

@javiereguiluz

NOTE: This issue is part of the "SymfonyCon 2014 Madrid Hackday" effort to add logs for every 2.7 deprecated feature. This is needed before removing those features in 3.0 version. Please, add you name in a comment of this issue if you are going to work on this.

If you need it, this Gist explains how to generate the deprecation note:

https://gist.github.com/javiereguiluz/a5514ec6cde2a63be441


The option "methods" of the Callback constraint was removed. You should
use the option "callback" instead. If you have multiple callbacks, add
multiple callback constraints instead.

Before (YAML):

constraints:
 - Callback: [firstCallback, secondCallback]

After (YAML):

constraints:
 - Callback: firstCallback
 - Callback: secondCallback

When using annotations, you can now put the Callback constraint directly on
the method that should be executed.

Before (Annotations):

use Symfony\Component\Validator\Constraints as Assert;
use Symfony\Component\Validator\ExecutionContextInterface;

/**
* @Assert\Callback({"callback"})
*/
class MyClass
{
   public function callback(ExecutionContextInterface $context)
   {
       // ...
   }
}

After (Annotations):

use Symfony\Component\Validator\Constraints as Assert;
use Symfony\Component\Validator\ExecutionContextInterface;

class MyClass
{
   /**
    * @Assert\Callback
    */
   public function callback(ExecutionContextInterface $context)
   {
       // ...
   }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions