|
@@ -1,27 +0,0 @@
|
|
|
-<?php
|
|
|
-
|
|
|
-namespace FTTHBundle\Validator;
|
|
|
-
|
|
|
-use Symfony\Component\Validator\Context\ExecutionContextInterface;
|
|
|
-use FTTHBundle\Entity\NAP;
|
|
|
-
|
|
|
-class ONUPositionValidator
|
|
|
-{
|
|
|
-
|
|
|
- /**
|
|
|
- * @param int $value
|
|
|
- * @param ExecutionContextInterface $context
|
|
|
- * @param array $payload
|
|
|
- */
|
|
|
- public static function validate($value, ExecutionContextInterface $context, $payload)
|
|
|
- {
|
|
|
- if ($value == 0) {
|
|
|
- $value = $context->getObject()->getNewPosition();
|
|
|
- }
|
|
|
- if ($value > NAP::MAX_NUMBER_ONU) {
|
|
|
- $context->buildViolation('error.max_number_onu_invalid')
|
|
|
- ->addViolation();
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
-}
|