public function createRelations($definition = null)
    {
        $actions = array();
        $transitions = new ArrayObject();
        $sort = 1;
        foreach ($this->structure as $relationName => $relationTemplate) {
            $isAction = isset($relationTemplate['type']);
            $isUsers = ($relationName == 'users');
            $isGroups = ($relationName == 'groups');

            // Process actions on WorkflowDefinition from the template
            if ($isAction) {
                $action = $this->createAction($relationName, $relationTemplate, $definition);
                // add a sort value in!
                $action->Sort = $sort++;
                $action->write();

                $actions[$relationName] = $action;

                $newTransitions = $this->updateActionTransitions($relationTemplate, $action);
                foreach ($newTransitions as $t) {
                    $transitions->append($t);
                }
            }
            // Process users on WorkflowDefinition from the template
            if ($isUsers) {
                $this->createUsers($relationTemplate, $definition);
            }
            // Process groups on WorkflowDefinition from the template
            if ($isGroups) {
                $this->createGroups($relationTemplate, $definition);
            }
        }

        foreach ($transitions as $transition) {
            if (isset($actions[$transition->Target])) {
                $transition->NextActionID = $actions[$transition->Target]->ID;
            }
            $transition->write();
        }

        return $actions;
    }
public function createRelations($definition = null)
    {
        $actions = array();
        $transitions = new ArrayObject();
        $sort = 1;
        foreach ($this->structure as $relationName => $relationTemplate) {
            $isAction = isset($relationTemplate['type']);
            $isUsers = ($relationName == 'users');
            $isGroups = ($relationName == 'groups');

            // Process actions on WorkflowDefinition from the template
            if ($isAction) {
                $action = $this->createAction($relationName, $relationTemplate, $definition);
                // add a sort value in!
                $action->Sort = $sort++;
                $action->write();

                $actions[$relationName] = $action;

                $newTransitions = $this->updateActionTransitions($relationTemplate, $action);
                foreach ($newTransitions as $t) {
                    $transitions->append($t);
                }
            }
            // Process users on WorkflowDefinition from the template
            if ($isUsers) {
                $this->createUsers($relationTemplate, $definition);
            }
            // Process groups on WorkflowDefinition from the template
            if ($isGroups) {
                $this->createGroups($relationTemplate, $definition);
            }
        }

        foreach ($transitions as $transition) {
            if (isset($actions[$transition->Target])) {
                $transition->NextActionID = $actions[$transition->Target]->ID;
            }
            $transition->write();
        }

        return $actions;
    }
public function createRelations ( $ definition = null ) { $ actions = array ( ) ; $ transitions = new ArrayObject ( ) ; $ sort = 1 ; foreach ( $ this -> structure as $ relationName => $ relationTemplate ) { $ isAction = isset ( $ relationTemplate [ 'type' ] ) ; $ isUsers = ( $ relationName == 'users' ) ; $ isGroups = ( $ relationName == 'groups' ) ; // Process actions on WorkflowDefinition from the template if ( $ isAction ) { $ action = $ this -> createAction ( $ relationName , $ relationTemplate , $ definition ) ; // add a sort value in! $ action -> Sort = $ sort ++ ; $ action -> write ( ) ; $ actions [ $ relationName ] = $ action ; $ newTransitions = $ this -> updateActionTransitions ( $ relationTemplate , $ action ) ; foreach ( $ newTransitions as $ t ) { $ transitions -> append ( $ t ) ; } } // Process users on WorkflowDefinition from the template if ( $ isUsers ) { $ this -> createUsers ( $ relationTemplate , $ definition ) ; } // Process groups on WorkflowDefinition from the template if ( $ isGroups ) { $ this -> createGroups ( $ relationTemplate , $ definition ) ; } } foreach ( $ transitions as $ transition ) { if ( isset ( $ actions [ $ transition -> Target ] ) ) { $ transition -> NextActionID = $ actions [ $ transition -> Target ] -> ID ; } $ transition -> write ( ) ; } return $ actions ; }
Creates the relevant data objects for this structure, returning an array
of actions in the order they've been created

@param WorkflowDefinition $definitino
An optional workflow definition to bind the actions into
@return array
Creates the relevant data objects for this structure returning an array of actions in the order they ve been created