|
@@ -2,6 +2,8 @@
|
|
|
|
|
|
namespace FTTHBundle\Admin;
|
|
|
|
|
|
+use FTTHBundle\Entity\OLT;
|
|
|
+use FTTHBundle\Entity\ONU;
|
|
|
use FTTHBundle\Form\AnchorType;
|
|
|
use Sonata\AdminBundle\Datagrid\DatagridMapper;
|
|
|
use Sonata\AdminBundle\Datagrid\ListMapper;
|
|
@@ -169,4 +171,32 @@ class OLTAdmin extends WorkflowBaseAdmin
|
|
|
;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * @param OLT $olt
|
|
|
+ * @throws \Exception
|
|
|
+ */
|
|
|
+ public function prePersist($olt)
|
|
|
+ {
|
|
|
+ $this->validateTimeout($olt);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @param OLT $olt
|
|
|
+ * @throws \Exception
|
|
|
+ */
|
|
|
+ public function preUpdate($olt)
|
|
|
+ {
|
|
|
+ $this->validateTimeout($olt);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @param OLT $olt
|
|
|
+ * @throws \Exception
|
|
|
+ */
|
|
|
+ private function validateTimeout($olt){
|
|
|
+ if($olt->getOltTimeout() > 50){
|
|
|
+ throw new \Exception("El tiempo de espera debe ser inferior al tiempo de procesamiento");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
}
|