コード例 #1
0
 /**
  * Indicates whether the constraint is valid
  *
  * @param object     $recipient
  * @param Constraint $constraint
  */
 public function isValid($recipient, Constraint $constraint)
 {
     if ($recipient && !$this->authorizer->canMessageParticipant($recipient)) {
         $this->setMessage($constraint->message);
         return false;
     }
     return true;
 }
コード例 #2
0
 /**
  * Indicates whether the constraint is valid
  *
  * @param object     $value
  * @param Constraint $constraint
  */
 public function validate($value, Constraint $constraint)
 {
     $sender = $this->participantProvider->getAuthenticatedParticipant();
     $recipients = $value->getThread()->getOtherParticipants($sender);
     foreach ($recipients as $recipient) {
         if (!$this->authorizer->canMessageParticipant($recipient)) {
             $this->context->addViolation($constraint->message);
             return;
         }
     }
 }
コード例 #3
0
 /**
  * Indicates whether the constraint is valid
  *
  * @param object     $value
  * @param Constraint $constraint
  */
 public function isValid($value, Constraint $constraint)
 {
     $sender = $this->participantProvider->getAuthenticatedParticipant();
     $recipients = $value->getThread()->getOtherParticipants($sender);
     foreach ($recipients as $recipient) {
         if (!$this->authorizer->canMessageParticipant($recipient)) {
             $this->setMessage($constraint->message);
             return false;
         }
     }
     return true;
 }
コード例 #4
0
 /**
  * Indicates whether the constraint is valid
  *
  * @param object     $recipient
  * @param Constraint $constraint
  */
 public function validate($recipient, Constraint $constraint)
 {
     if ($recipient && !$this->authorizer->canMessageParticipant($recipient)) {
         $this->context->addViolation($constraint->message);
     }
 }