/** * @param WorkflowDefinition $definition * @return array */ protected function getDataAsArray(WorkflowDefinition $definition) { $data = array('name' => $definition->getName(), 'label' => $definition->getLabel(), 'entity' => $definition->getRelatedEntity(), 'configuration' => $definition->getConfiguration()); if ($definition->getStartStep()) { $data['start_step'] = $definition->getStartStep()->getName(); } return $data; }
/** * @param WorkflowDefinition $definition * @param string $name * @param array $options * @return Attribute */ protected function assembleAttribute(WorkflowDefinition $definition, $name, array $options) { if (!empty($options['property_path'])) { $options = $this->guessOptions($options, $definition->getRelatedEntity(), $options['property_path']); } $this->assertOptions($options, array('label', 'type')); $this->assertAttributeEntityAcl($options); $attribute = new Attribute(); $attribute->setName($name); $attribute->setLabel($options['label']); $attribute->setType($options['type']); $attribute->setEntityAcl($this->getOption($options, 'entity_acl', array())); $attribute->setPropertyPath($this->getOption($options, 'property_path')); $attribute->setOptions($this->getOption($options, 'options', array())); $this->validateAttribute($attribute); return $attribute; }
/** * @param WorkflowDefinition $workflowDefinition */ public function resetWorkflowData(WorkflowDefinition $workflowDefinition) { $this->getWorkflowItemRepository()->resetWorkflowData($workflowDefinition->getRelatedEntity(), array($workflowDefinition->getName())); }
/** * @param WorkflowDefinition $definition * @return WorkflowDefinition */ public function import(WorkflowDefinition $definition) { $this->setName($definition->getName())->setLabel($definition->getLabel())->setRelatedEntity($definition->getRelatedEntity())->setEntityAttributeName($definition->getEntityAttributeName())->setConfiguration($definition->getConfiguration())->setSteps($definition->getSteps())->setStartStep($definition->getStartStep())->setStepsDisplayOrdered($definition->isStepsDisplayOrdered())->setEntityAcls($definition->getEntityAcls())->setSystem($definition->isSystem()); return $this; }