public function createLocationsFromNodeAssignments($contentId, $versionNo)
    {
        // select all node assignments with OP_CODE_CREATE (3) for this content
        $query = $this->handler->createSelectQuery();
        $query
            ->select('*')
            ->from($this->handler->quoteTable('eznode_assignment'))
            ->where(
                $query->expr->lAnd(
                    $query->expr->eq(
                        $this->handler->quoteColumn('contentobject_id'),
                        $query->bindValue($contentId, null, \PDO::PARAM_INT)
                    ),
                    $query->expr->eq(
                        $this->handler->quoteColumn('contentobject_version'),
                        $query->bindValue($versionNo, null, \PDO::PARAM_INT)
                    ),
                    $query->expr->eq(
                        $this->handler->quoteColumn('op_code'),
                        $query->bindValue(self::NODE_ASSIGNMENT_OP_CODE_CREATE, null, \PDO::PARAM_INT)
                    )
                )
            )->orderBy('id');
        $statement = $query->prepare();
        $statement->execute();

        // convert all these assignments to nodes

        while ($row = $statement->fetch(\PDO::FETCH_ASSOC)) {
            if ((bool)$row['is_main'] === true) {
                $mainLocationId = true;
            } else {
                $mainLocationId = $this->getMainNodeId($contentId);
            }

            $parentLocationData = $this->getBasicNodeData($row['parent_node']);
            $isInvisible = $row['is_hidden'] || $parentLocationData['is_hidden'] || $parentLocationData['is_invisible'];
            $this->create(
                new CreateStruct(
                    array(
                        'contentId' => $row['contentobject_id'],
                        'contentVersion' => $row['contentobject_version'],
                        'mainLocationId' => $mainLocationId,
                        'remoteId' => $row['parent_remote_id'],
                        'sortField' => $row['sort_field'],
                        'sortOrder' => $row['sort_order'],
                        'priority' => $row['priority'],
                        'hidden' => $row['is_hidden'],
                        'invisible' => $isInvisible,
                    )
                ),
                $parentLocationData
            );

            $this->updateNodeAssignment(
                $row['contentobject_id'],
                $row['parent_node'],
                $row['parent_node'],
                self::NODE_ASSIGNMENT_OP_CODE_CREATE_NOP
            );
        }
    }
public function createLocationsFromNodeAssignments($contentId, $versionNo)
    {
        // select all node assignments with OP_CODE_CREATE (3) for this content
        $query = $this->handler->createSelectQuery();
        $query
            ->select('*')
            ->from($this->handler->quoteTable('eznode_assignment'))
            ->where(
                $query->expr->lAnd(
                    $query->expr->eq(
                        $this->handler->quoteColumn('contentobject_id'),
                        $query->bindValue($contentId, null, \PDO::PARAM_INT)
                    ),
                    $query->expr->eq(
                        $this->handler->quoteColumn('contentobject_version'),
                        $query->bindValue($versionNo, null, \PDO::PARAM_INT)
                    ),
                    $query->expr->eq(
                        $this->handler->quoteColumn('op_code'),
                        $query->bindValue(self::NODE_ASSIGNMENT_OP_CODE_CREATE, null, \PDO::PARAM_INT)
                    )
                )
            )->orderBy('id');
        $statement = $query->prepare();
        $statement->execute();

        // convert all these assignments to nodes

        while ($row = $statement->fetch(\PDO::FETCH_ASSOC)) {
            if ((bool)$row['is_main'] === true) {
                $mainLocationId = true;
            } else {
                $mainLocationId = $this->getMainNodeId($contentId);
            }

            $parentLocationData = $this->getBasicNodeData($row['parent_node']);
            $isInvisible = $row['is_hidden'] || $parentLocationData['is_hidden'] || $parentLocationData['is_invisible'];
            $this->create(
                new CreateStruct(
                    array(
                        'contentId' => $row['contentobject_id'],
                        'contentVersion' => $row['contentobject_version'],
                        'mainLocationId' => $mainLocationId,
                        'remoteId' => $row['parent_remote_id'],
                        'sortField' => $row['sort_field'],
                        'sortOrder' => $row['sort_order'],
                        'priority' => $row['priority'],
                        'hidden' => $row['is_hidden'],
                        'invisible' => $isInvisible,
                    )
                ),
                $parentLocationData
            );

            $this->updateNodeAssignment(
                $row['contentobject_id'],
                $row['parent_node'],
                $row['parent_node'],
                self::NODE_ASSIGNMENT_OP_CODE_CREATE_NOP
            );
        }
    }
public function createLocationsFromNodeAssignments ( $ contentId , $ versionNo ) { // select all node assignments with OP_CODE_CREATE (3) for this content $ query = $ this -> handler -> createSelectQuery ( ) ; $ query -> select ( '*' ) -> from ( $ this -> handler -> quoteTable ( 'eznode_assignment' ) ) -> where ( $ query -> expr -> lAnd ( $ query -> expr -> eq ( $ this -> handler -> quoteColumn ( 'contentobject_id' ) , $ query -> bindValue ( $ contentId , null , \ PDO :: PARAM_INT ) ) , $ query -> expr -> eq ( $ this -> handler -> quoteColumn ( 'contentobject_version' ) , $ query -> bindValue ( $ versionNo , null , \ PDO :: PARAM_INT ) ) , $ query -> expr -> eq ( $ this -> handler -> quoteColumn ( 'op_code' ) , $ query -> bindValue ( self :: NODE_ASSIGNMENT_OP_CODE_CREATE , null , \ PDO :: PARAM_INT ) ) ) ) -> orderBy ( 'id' ) ; $ statement = $ query -> prepare ( ) ; $ statement -> execute ( ) ; // convert all these assignments to nodes while ( $ row = $ statement -> fetch ( \ PDO :: FETCH_ASSOC ) ) { if ( ( bool ) $ row [ 'is_main' ] === true ) { $ mainLocationId = true ; } else { $ mainLocationId = $ this -> getMainNodeId ( $ contentId ) ; } $ parentLocationData = $ this -> getBasicNodeData ( $ row [ 'parent_node' ] ) ; $ isInvisible = $ row [ 'is_hidden' ] || $ parentLocationData [ 'is_hidden' ] || $ parentLocationData [ 'is_invisible' ] ; $ this -> create ( new CreateStruct ( array ( 'contentId' => $ row [ 'contentobject_id' ] , 'contentVersion' => $ row [ 'contentobject_version' ] , 'mainLocationId' => $ mainLocationId , 'remoteId' => $ row [ 'parent_remote_id' ] , 'sortField' => $ row [ 'sort_field' ] , 'sortOrder' => $ row [ 'sort_order' ] , 'priority' => $ row [ 'priority' ] , 'hidden' => $ row [ 'is_hidden' ] , 'invisible' => $ isInvisible , ) ) , $ parentLocationData ) ; $ this -> updateNodeAssignment ( $ row [ 'contentobject_id' ] , $ row [ 'parent_node' ] , $ row [ 'parent_node' ] , self :: NODE_ASSIGNMENT_OP_CODE_CREATE_NOP ) ; } }
Create locations from node assignments.

Convert existing node assignments into real locations.

@param mixed $contentId
@param mixed $versionNo
Create locations from node assignments .