I have this error. Help please.
I use this instruction http://symfony.com/doc/current/reference/constraints/Callback.html for 3.0 version (i use Symfony 3.0)
My validation.yml
App\Bundle\NameBundle\Entity\Product:
constraints:
- Callback: [validate]
Entity
namespace App\Bundle\NameBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Context\ExecutionContextInterface;
/**
* Product
*/
class Product
{
/**
* @var integer
*/
private $id;
/* ... some code .... */
public function validate(ExecutionContextInterface $context)
{
$context->buildViolation('This name sounds totally fake!')
->atPath('firstName')
->addViolation();
}
}
what am I doing wrong?
SOLUTION:
in validation.yml
...
- Callback: validate
...