Example #1
0
 /**
  * Transit workflow item.
  *
  * @param WorkflowItem $workflowItem
  * @param string|Transition $transition
  * @throws ForbiddenTransitionException
  * @throws InvalidTransitionException
  */
 public function transit(WorkflowItem $workflowItem, $transition)
 {
     $transition = $this->transitionManager->extractTransition($transition);
     $this->checkTransitionValid($transition, $workflowItem, true);
     $transitionRecord = $this->createTransitionRecord($workflowItem, $transition);
     $transition->transit($workflowItem);
     $workflowItem->addTransitionRecord($transitionRecord);
     $entity = $workflowItem->getEntity();
     $this->entityConnector->setWorkflowItem($entity, $workflowItem);
     $this->entityConnector->setWorkflowStep($entity, $workflowItem->getCurrentStep());
     $this->aclManager->updateAclIdentities($workflowItem);
 }
Example #2
0
 /**
  * @expectedException \Oro\Bundle\WorkflowBundle\Exception\WorkflowException
  * @expectedExceptionMessage Value of attribute "attribute" must be an object
  */
 public function testUpdateAclIdentitiesNotAnObjectException()
 {
     $workflowName = 'test_workflow';
     $step = new WorkflowStep();
     $step->setName('step');
     $attribute = new Attribute();
     $attribute->setName('attribute')->setOption('class', 'TestEntity');
     $entityAcl = new WorkflowEntityAcl();
     $entityAcl->setStep($step)->setAttribute($attribute->getName());
     $definition = new WorkflowDefinition();
     $definition->setName($workflowName)->setSteps(array($step))->setEntityAcls(array($entityAcl));
     $this->setWorkflow($workflowName, array($attribute));
     $workflowItem = new WorkflowItem();
     $workflowItem->setWorkflowName($workflowName)->setDefinition($definition)->setCurrentStep($step);
     $workflowItem->getData()->set($attribute->getName(), 'not_an_object');
     $this->manager->updateAclIdentities($workflowItem);
 }