Programming Language PHP

Namespace Oro\Bundle\WorkflowBundle\Handler\Helper

Class WorkflowDefinitionCloner

Total Examples 2

2 code examples of PHP Oro\Bundle\WorkflowBundle\Handler\Helper\WorkflowDefinitionCloner extracted from open source projects

Was this example useful?
0
                                                    public function testMergeDefinition()
    {
        $sourceDefinition = $this->createDefinition();

        $definition = new WorkflowDefinition();

        WorkflowDefinitionCloner::mergeDefinition($definition, $sourceDefinition);

        $this->assertSameMainFields($definition, $sourceDefinition);

        $this->assertEquals($definition, $sourceDefinition);
        $this->assertNotSame($definition, $sourceDefinition);

        $this->assertSame($definition->getStartStep(), $sourceDefinition->getStartStep());

        $this->assertObjectsDefinitions($definition, $sourceDefinition);
    }
                                            
Was this example useful?
0
                                                    /**
     * @param WorkflowDefinition|null $newDefinition
     * @throws \Exception
     */
    public function updateWorkflowDefinition(WorkflowDefinition $existingDefinition, WorkflowDefinition $newDefinition)
    {
        $originalDefinition = WorkflowDefinitionCloner::cloneDefinition($existingDefinition);

        WorkflowDefinitionCloner::mergeDefinition($existingDefinition, $newDefinition);

        $this->eventDispatcher->dispatch(
            new WorkflowChangesEvent($existingDefinition, $originalDefinition),
            WorkflowEvents::WORKFLOW_BEFORE_UPDATE
        );

        $this->process($existingDefinition);

        $this->eventDispatcher->dispatch(
            new WorkflowChangesEvent($existingDefinition, $originalDefinition),
            WorkflowEvents::WORKFLOW_AFTER_UPDATE
        );
    }
                                            
WorkflowDefinitionCloner's Other Methods
WorkflowDefinitionCloner's Other Methods