buildViolation() public method

public buildViolation ( $message, array $parameters = [] )
$parameters array
 public function validateConstraintWithCustomDomain(ExecutionContext $context)
 {
     $context->buildViolation('entity.custom-domain')->setTranslationDomain('custom-domain')->addViolation();
 }
示例#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();
     }
 }