/** * Remove related workflow item * * @param LifecycleEventArgs $args */ public function preRemove(LifecycleEventArgs $args) { $entity = $args->getEntity(); if ($this->entityConnector->isWorkflowAware($entity)) { $workflowItem = $this->entityConnector->getWorkflowItem($entity); if ($workflowItem) { $args->getEntityManager()->remove($workflowItem); } } }
/** * @expectedException \Oro\Bundle\WorkflowBundle\Exception\WorkflowException * @expectedExceptionMessage Can't get property "workflowItem" from entity */ public function testGetWorkflowItemException() { $this->entityConnector->getWorkflowItem(new \DateTime()); }