瀏覽代碼

Merge branch 'ftth#94' into 'master'

Updated action to remove the Radius becase had a problem with template and...

See merge request interlink-sa/flowdat3/modules/ftth!200
Jean Sumara Leopoldo 4 年之前
父節點
當前提交
3a81eddef1
共有 2 個文件被更改,包括 31 次插入1 次删除
  1. 1 1
      app/DoctrineMigrations/src/action.yml
  2. 30 0
      src/FTTHBundle/Admin/OLTAdmin.php

File diff suppressed because it is too large
+ 1 - 1
app/DoctrineMigrations/src/action.yml


+ 30 - 0
src/FTTHBundle/Admin/OLTAdmin.php

@@ -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");
+        }
+    }
+
 }