eZ\Publish\Core\Persistence\Legacy\Content\TreeHandler::changeMainLocation PHP Method

changeMainLocation() public method

Updates ezcontentobject_tree and eznode_assignment tables (eznode_assignment for content current version number).
public changeMainLocation ( mixed $contentId, mixed $locationId )
$contentId mixed
$locationId mixed
    public function changeMainLocation($contentId, $locationId)
    {
        $parentLocationId = $this->loadLocation($locationId)->parentId;
        // Update ezcontentobject_tree and eznode_assignment tables
        $this->locationGateway->changeMainLocation($contentId, $locationId, $this->loadContentInfo($contentId)->currentVersionNo, $parentLocationId);
        // Update subtree section to the one of the new main location parent location content
        $this->setSectionForSubtree($locationId, $this->loadContentInfo($this->loadLocation($parentLocationId)->contentId)->sectionId);
    }

Usage Example

Example #1
0
 /**
  * Changes main location of content identified by given $contentId to location identified by given $locationId
  *
  * Updates ezcontentobject_tree and eznode_assignment tables (eznode_assignment for content current version number).
  *
  * @param mixed $contentId
  * @param mixed $locationId
  *
  * @return void
  */
 public function changeMainLocation($contentId, $locationId)
 {
     $this->treeHandler->changeMainLocation($contentId, $locationId);
 }