コード例 #1
0
 public function validate($value, Constraint $constraint)
 {
     $currentViolationsCount = \count($this->context->getViolations());
     $currentMessage = $constraint->message;
     $constraint->message = $constraint->invalidEmailMessage;
     // switch first to invalidEmailMessage
     // do validation of EmailValidator
     parent::validate($value, $constraint);
     // there was violation in EmailValidator
     if (\count($this->context->getViolations()) > $currentViolationsCount) {
         return;
     }
     $constraint->message = $currentMessage;
     // switch to original constraint message
     if ($constraint->currentAccountEmail != $value) {
         // if email set is same as the current email do nothing
         $user = $this->service->find(array('email' => $value), array());
         if (!$user) {
             return;
         }
         $this->context->addViolation($constraint->message, array('{{ field }}' => $value));
     }
     return;
 }
コード例 #2
0
 /**
  * @expectedException HealthCareAbroad\UserBundle\Services\Exception\FailedAccountRequestException
  */
 public function testFindWithInvalidSearchByOptions()
 {
     $searchBy = array('this-is-an-invalid-key-for-sure' => 1, 'email' => '*****@*****.**');
     $options = array('limit' => 1);
     $this->service->find($searchBy, $options);
 }
コード例 #3
0
 public function getAccountDataById($id)
 {
     return $this->service->getAccountDataById($id);
 }