Pārlūkot izejas kodu

Refactory workflowadmin

Guillermo Espinoza 7 gadi atpakaļ
vecāks
revīzija
87b32b6f42
2 mainītis faili ar 8 papildinājumiem un 14 dzēšanām
  1. 6 9
      Admin/WorkflowAdmin.php
  2. 2 5
      Utils/WorkFlowEntityClasses.php

+ 6 - 9
Admin/WorkflowAdmin.php

@@ -91,14 +91,7 @@ transitions:
         } else {
             $this->parameters = array('workflow_name' => $this->getSubject()->getName(), 'workflow_subject' => $this->getSubject()->getSubject());
         }
-        $_supports = WorkFlowEntityClasses::getClass();
-        $supports = array();
-        foreach($_supports as $key => $class) {
-            if(class_exists($key)) {
-                $supports[$key] = $key;
-            }
-        }
-        
+                
         $formMapper
             ->add('name')
             ->add('description')
@@ -106,7 +99,11 @@ transitions:
             ->add('type', 'choice', array('choices' => array('state_machine' => 'state_machine', 'workflow' => 'workflow')))
             ->add('markingType', 'choice', array('choices' => array('single_state' => 'single_state', 'multiple_state' => 'multiple_state')))
             ->add('markingName', 'choice', array('choices' => array('currentState' => 'currentState')))
-            ->add('support', 'choice', array('choices' => $supports,'multiple'   => true, 'required' => true))
+            ->add('support', 'choice', array(
+                'choices' => array_filter(WorkFlowEntityClasses::getChoices(), 'class_exists'),
+                'multiple'   => true, 
+                'required' => true
+                ))
             ->add('template', null, $tempate_options)
 
             ->setHelps(array(

+ 2 - 5
Utils/WorkFlowEntityClasses.php

@@ -18,10 +18,7 @@ class WorkFlowEntityClasses
     const FTTH_OLT = 'FTTHBundle\Entity\OLT';
     
     const BASE_CLIENT = 'ClientBundle\Entity\Client';
-
-    public function getClass() 
-    {
-        return array(self::FTTH_ONU => self::FTTH_ONU, self::FTTH_OLT => self::FTTH_OLT, self::BASE_CLIENT => self::BASE_CLIENT);
-    }
+    
+    const CABLEMODEM_CABLEMODEM = 'CablemodemBundle\Entity\Cablemodem';
 
 }