Pimcore\Model\Document\Email\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 ) : void
$id integer
Результат void
    public function getById($id = null)
    {
        try {
            if ($id != null) {
                $this->model->setId($id);
            }
            $data = $this->db->fetchRow("SELECT documents.*, documents_email.*, tree_locks.locked FROM documents\n                LEFT JOIN documents_email ON documents.id = documents_email.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) {
                $this->assignVariablesToModel($data);
            } else {
                throw new \Exception("Email Document with the ID " . $this->model->getId() . " doesn't exists");
            }
        } catch (\Exception $e) {
            throw $e;
        }
    }