protected function copySubtree($actionMap, $oldParentAliasId, $newParentAliasId)
    {
        $rows = $this->gateway->loadAutogeneratedEntries($oldParentAliasId);
        $newIdsMap = array();
        foreach ($rows as $row) {
            $oldParentAliasId = $row['id'];

            // Ensure that same action entries remain grouped by the same id
            if (!isset($newIdsMap[$oldParentAliasId])) {
                $newIdsMap[$oldParentAliasId] = $this->gateway->getNextId();
            }

            $row['action'] = $actionMap[$row['action']];
            $row['parent'] = $newParentAliasId;
            $row['id'] = $row['link'] = $newIdsMap[$oldParentAliasId];
            $this->gateway->insertRow($row);

            $this->copySubtree(
                $actionMap,
                $oldParentAliasId,
                $row['id']
            );
        }
    }
protected function copySubtree($actionMap, $oldParentAliasId, $newParentAliasId)
    {
        $rows = $this->gateway->loadAutogeneratedEntries($oldParentAliasId);
        $newIdsMap = array();
        foreach ($rows as $row) {
            $oldParentAliasId = $row['id'];

            // Ensure that same action entries remain grouped by the same id
            if (!isset($newIdsMap[$oldParentAliasId])) {
                $newIdsMap[$oldParentAliasId] = $this->gateway->getNextId();
            }

            $row['action'] = $actionMap[$row['action']];
            $row['parent'] = $newParentAliasId;
            $row['id'] = $row['link'] = $newIdsMap[$oldParentAliasId];
            $this->gateway->insertRow($row);

            $this->copySubtree(
                $actionMap,
                $oldParentAliasId,
                $row['id']
            );
        }
    }
protected function copySubtree ( $ actionMap , $ oldParentAliasId , $ newParentAliasId ) { $ rows = $ this -> gateway -> loadAutogeneratedEntries ( $ oldParentAliasId ) ; $ newIdsMap = array ( ) ; foreach ( $ rows as $ row ) { $ oldParentAliasId = $ row [ 'id' ] ; // Ensure that same action entries remain grouped by the same id if ( ! isset ( $ newIdsMap [ $ oldParentAliasId ] ) ) { $ newIdsMap [ $ oldParentAliasId ] = $ this -> gateway -> getNextId ( ) ; } $ row [ 'action' ] = $ actionMap [ $ row [ 'action' ] ] ; $ row [ 'parent' ] = $ newParentAliasId ; $ row [ 'id' ] = $ row [ 'link' ] = $ newIdsMap [ $ oldParentAliasId ] ; $ this -> gateway -> insertRow ( $ row ) ; $ this -> copySubtree ( $ actionMap , $ oldParentAliasId , $ row [ 'id' ] ) ; } }
Recursively copies aliases from old parent under new parent.

@param array $actionMap
@param mixed $oldParentAliasId
@param mixed $newParentAliasId
Recursively copies aliases from old parent under new parent .