eZ\Publish\Core\Persistence\Legacy\Content\Location\Gateway\DoctrineDatabase::setSectionForSubtree PHP Method

setSectionForSubtree() public method

Set section on all content objects in the subtree.
public setSectionForSubtree ( mixed $pathString, mixed $sectionId ) : boolean
$pathString mixed
$sectionId mixed
return boolean
    public function setSectionForSubtree($pathString, $sectionId)
    {
        $query = $this->handler->createUpdateQuery();
        $subSelect = $query->subSelect();
        $subSelect->select($this->handler->quoteColumn('contentobject_id'))->from($this->handler->quoteTable('ezcontentobject_tree'))->where($subSelect->expr->like($this->handler->quoteColumn('path_string'), $subSelect->bindValue($pathString . '%')));
        $query->update($this->handler->quoteTable('ezcontentobject'))->set($this->handler->quoteColumn('section_id'), $query->bindValue($sectionId))->where($query->expr->in($this->handler->quoteColumn('id'), $subSelect));
        $query->prepare()->execute();
    }