workflow; } /** * @param Workflow $workflow * * @return $this */ public function setWorkflow($workflow) { $this->workflow = $workflow; return $this; } /** * @return string */ public function getCurrentState() { return $this->currentState; } /** * @param string $currentState * * @return WorkflowInterface */ public function setCurrentState($currentState) { $this->currentState = $currentState; return $this; } /** * @return string */ public function getTransitionState() { return $this->transitionState; } /** * @param string $transitionState * * @return WorkflowInterface */ public function setTransitionState($transitionState) { $this->transitionState = $transitionState; 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 */ public function getTransitionWorkflow() { return "transition_state"; } /** * @return null|string */ public function getWorkflowType() { $workflow = $this->getWorkflow(); if ($workflow) { return $workflow->getType(); } return null; } /** * @return null|string */ public function getWorkflowName() { $workflow = $this->getWorkflow(); if ($workflow) { return $workflow->getName(); } return null; } /** * Para coincider entre estos workflow servidos por servicio y aquellos levantados por ABM * * @global AppKernel $kernel * * @return Workflow */ public function getServiceWorkflow() { global $kernel; $registry = $kernel->getContainer()->get('workflow.registry'); $workflow_name = null; $workflow = $this->getWorkflow(); if ($workflow) { $workflow_name = $workflow->getName(); } try { $workflow = $registry->get($this, $workflow_name); } catch (ExceptionInterface $e) { $kernel->getContainer()->get('session')->getFlashBag()->add('danger', $kernel->getContainer()->get('translator')->trans('Incorrect Workflow', array(), 'FTTHBundle')); return null; } return $workflow; } }