buildViolation() public method

public buildViolation ( $message, array $parameters = [] )
$parameters array
 public function validateConstraintWithCustomDomain(ExecutionContext $context)
 {
     $context->buildViolation('entity.custom-domain')->setTranslationDomain('custom-domain')->addViolation();
 }
Ejemplo n.º 2
0
 /**
  * @Assert\Callback
  */
 public function validate(ExecutionContext $context)
 {
     $parentTaxon = $this->getParent();
     while ($parentTaxon) {
         if ($parentTaxon == $this) {
             $context->buildViolation('Circular taxonomy reference detected. Please check your parent taxonomy.')->atPath('parent')->addViolation();
             break;
         }
         $parentTaxon = $parentTaxon->getParent();
     }
 }