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; }
/** * @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); }
public function getAccountDataById($id) { return $this->service->getAccountDataById($id); }