/** * @expectedException \Oro\Bundle\WorkflowBundle\Exception\UnknownAttributeException * @expectedExceptionMessage There is no entity attribute */ public function testEntityAttributeException() { $attributeManager = new AttributeManager(); $entityAttributeName = 'test'; $attributeManager->setEntityAttributeName($entityAttributeName); $attributeManager->getEntityAttribute(); }
/** * Create workflow item. * * @param object $entity * @param array $data * @return WorkflowItem */ public function createWorkflowItem($entity, array $data = array()) { $entityAttributeName = $this->attributeManager->getEntityAttribute()->getName(); $workflowItem = new WorkflowItem(); $workflowItem->setWorkflowName($this->getName())->setEntity($entity); if (array_key_exists($entityAttributeName, $data)) { unset($data[$entityAttributeName]); } $workflowItem->getData()->set($entityAttributeName, $entity)->setFieldsMapping($this->getAttributesMapping())->add($data); $workflowItem->setDefinition($this->getDefinition()); return $workflowItem; }