foreach ( $nodes as $node ) { $data = array( 'id' => null, 'contentobject_id' => $object->attribute( 'id' ), 'contentobject_version' => $version->attribute( 'version' ), 'parent_node' => $node->attribute( 'parent_node_id' ), 'sort_field' => $node->attribute( 'sort_field' ), 'sort_order' => $node->attribute( 'sort_order' ), 'is_main' => ( $node->attribute( 'main_node_id' ) == $node->attribute( 'node_id' ) ? 1 : 0 ), 'parent_remote_id' => $node->attribute( 'remote_id' ), 'op_code' => EZ_NODE_ASSIGNMENT_OP_CODE_NOP ); $assignment = eZNodeAssignment::create( $data ); $assignedNodeArray[$i] = $assignment; $parentNodeIDMap[$node->attribute( 'parent_node_id' )] = $i; ++$i; }