浏览代码

Workflow functions updated

Guillermo Espinoza 6 年之前
父节点
当前提交
8d6ff4d141
共有 2 个文件被更改,包括 48 次插入8 次删除
  1. 17 3
      Entity/Interfaces/WorkflowInterface.php
  2. 31 5
      Entity/Traits/WorkflowTrait.php

+ 17 - 3
Entity/Interfaces/WorkflowInterface.php

@@ -12,7 +12,7 @@ interface WorkflowInterface
 
     /**
      * @param Workflow $workflow
-     * 
+     *
      * @return $this
      */
     public function setWorkflow($workflow);
@@ -24,7 +24,7 @@ interface WorkflowInterface
 
     /**
      * @param string $currentState
-     * 
+     *
      * @return WorkflowInterface
      */
     public function setCurrentState($currentState);
@@ -36,8 +36,22 @@ interface WorkflowInterface
 
     /**
      * @param string $transitionState
-     * 
+     *
      * @return WorkflowInterface
      */
     public function setTransitionState($transitionState);
+
+    /**
+     * @return string
+     */
+    public function getAdministrativeState();
+
+    /**
+     * @param string $administrativeState
+     *
+     * @return WorkflowInterface
+     */
+    public function setAdministrativeState($administrativeState);
+
+
 }

+ 31 - 5
Entity/Traits/WorkflowTrait.php

@@ -15,7 +15,7 @@ trait WorkflowTrait
 
     /**
      * @param Workflow $workflow
-     * 
+     *
      * @return $this
      */
     public function setWorkflow($workflow)
@@ -35,7 +35,7 @@ trait WorkflowTrait
 
     /**
      * @param string $currentState
-     * 
+     *
      * @return WorkflowInterface
      */
     public function setCurrentState($currentState)
@@ -55,7 +55,7 @@ trait WorkflowTrait
 
     /**
      * @param string $transitionState
-     * 
+     *
      * @return WorkflowInterface
      */
     public function setTransitionState($transitionState)
@@ -65,6 +65,32 @@ trait WorkflowTrait
         return $this;
     }
 
+    /**
+     * Retorna el administrativeState en caso que exista en la entidad
+     *
+     * @return string
+     */
+    public function getAdministrativeState()
+    {
+        return property_exists(self::class, 'administrativeState') ? $this->administrativeState : null;
+    }
+
+    /**
+     * Setea el administrativeState en caso que exista en la entidad
+     *
+     * @param string $transitionState
+     *
+     * @return WorkflowInterface
+     */
+    public function setAdministrativeState($administrativeState)
+    {
+        if (property_exists(self::class, 'administrativeState')) {
+            $this->administrativeState = $administrativeState;
+        }
+
+        return $this;
+    }
+
     /**
      * @return string
      */
@@ -103,9 +129,9 @@ trait WorkflowTrait
 
     /**
      * Para coincider entre estos workflow servidos por servicio y aquellos levantados por ABM
-     * 
+     *
      * @global AppKernel $kernel
-     * 
+     *
      * @return Workflow
      */
     public function getServiceWorkflow()