Pimcore\Model\Document\Page\Dao::getById PHP Метод

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

Get the data for the object by the given id, or by the id which is set in the object
public getById ( integer $id = null )
$id integer
    public function getById($id = null)
    {
        try {
            if ($id != null) {
                $this->model->setId($id);
            }
            $data = $this->db->fetchRow("SELECT documents.*, documents_page.*, tree_locks.locked FROM documents\n                LEFT JOIN documents_page ON documents.id = documents_page.id\n                LEFT JOIN tree_locks ON documents.id = tree_locks.id AND tree_locks.type = 'document'\n                    WHERE documents.id = ?", $this->model->getId());
            if ($data["id"] > 0) {
                $data["metaData"] = @unserialize($data["metaData"]);
                if (!is_array($data["metaData"])) {
                    $data["metaData"] = [];
                }
                $this->assignVariablesToModel($data);
            } else {
                throw new \Exception("Page with the ID " . $this->model->getId() . " doesn't exists");
            }
        } catch (\Exception $e) {
            throw $e;
        }
    }