Ejemplo n.º 1
0
 /**
  * @param EmailModel $model
  *
  * @throws \InvalidArgumentException
  */
 protected function assertModel(EmailModel $model)
 {
     if (!$model->getFrom()) {
         throw new \InvalidArgumentException('Sender can not be empty');
     }
     if (!$model->getTo() && !$model->getCc() && !$model->getBcc()) {
         throw new \InvalidArgumentException('Recipient can not be empty');
     }
 }
Ejemplo n.º 2
0
 /**
  * @param Email $value
  * @param Constraint|EmailRecipients $constraint
  */
 public function validate($value, Constraint $constraint)
 {
     if (!$value->getTo() && !$value->getCc() && !$value->getBcc()) {
         $this->context->addViolation($constraint->message);
     }
 }