/** * Ensure that all database entities in workflow are still in Doctrine Unit of Work * * @param Workflow $workflow * @return Workflow * @throws WorkflowNotFoundException */ protected function refreshWorkflow(Workflow $workflow) { $refreshedDefinition = $this->refreshWorkflowDefinition($workflow->getDefinition()); $workflow->setDefinition($refreshedDefinition); return $workflow; }
/** * @param Workflow $workflow * @param Attribute $attribute * @param array $attributeOptions * @return array */ protected function guessAttributeOptions(Workflow $workflow, Attribute $attribute, array $attributeOptions) { if (!empty($attributeOptions['form_type'])) { return $attributeOptions; } $relatedEntity = $workflow->getDefinition()->getRelatedEntity(); $typeGuess = $this->attributeGuesser->guessClassAttributeForm($relatedEntity, $attribute); if (!$typeGuess) { return $attributeOptions; } $attributeOptions['form_type'] = $typeGuess->getType(); $attributeOptions['options'] = array_merge_recursive($attributeOptions['options'], $typeGuess->getOptions()); return $attributeOptions; }