如何在实体回调中添加Symfony Assert(Notblank(); Number(); Email(); ...)?
示例AppBundle\Entity\TrainingLead
:
/**
* @Assert\Callback
*/
public function rejectedValidate(ExecutionContextInterface $context)
{
if (null !== $this->rejectedAt) {
// How to add "Assert\NotBlank()" in rejectedContent" ?
$context->buildViolation('training_lead.reason')
->atPath('rejectedContent')
->addViolation()
;
}
}