Pimcore\Model\Object\AbstractObject\Dao::updateChildsPaths PHP Метод

updateChildsPaths() публичный Метод

Updates the paths for children, children's properties and children's permissions in the database
public updateChildsPaths ( string $oldPath ) : void
$oldPath string
Результат void
    public function updateChildsPaths($oldPath)
    {
        if ($this->hasChilds([Object::OBJECT_TYPE_OBJECT, Object::OBJECT_TYPE_FOLDER, Object::OBJECT_TYPE_VARIANT])) {
            //get objects to empty their cache
            $objects = $this->db->fetchCol("SELECT o_id FROM objects WHERE o_path LIKE ?", $oldPath . "%");
            $userId = "0";
            if ($user = \Pimcore\Tool\Admin::getCurrentUser()) {
                $userId = $user->getId();
            }
            //update object child paths
            $this->db->query("update objects set o_path = replace(o_path," . $this->db->quote($oldPath . "/") . "," . $this->db->quote($this->model->getRealFullPath() . "/") . "), o_modificationDate = '" . time() . "', o_userModification = '" . $userId . "' where o_path like " . $this->db->quote($oldPath . "/%") . ";");
            //update object child permission paths
            $this->db->query("update users_workspaces_object set cpath = replace(cpath," . $this->db->quote($oldPath . "/") . "," . $this->db->quote($this->model->getRealFullPath() . "/") . ") where cpath like " . $this->db->quote($oldPath . "/%") . ";");
            //update object child properties paths
            $this->db->query("update properties set cpath = replace(cpath," . $this->db->quote($oldPath . "/") . "," . $this->db->quote($this->model->getRealFullPath() . "/") . ") where cpath like " . $this->db->quote($oldPath . "/%") . ";");
            return $objects;
        }
    }