Conditions | 3 |
Paths | 3 |
Total Lines | 10 |
Code Lines | 6 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 12 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
20 | public function validate($value, Constraint $constraint) |
||
21 | { |
||
22 | if (!$constraint instanceof EntityExists) { |
||
23 | throw new UnexpectedTypeException($constraint, EntityExists::class); |
||
24 | } |
||
25 | $coach = $this->repository->findOneByEmail($value); |
||
26 | |||
27 | if (!$coach) { |
||
28 | $this->context->buildViolation($constraint->notExistMessage) |
||
29 | ->addViolation(); |
||
30 | } |
||
33 |