Pimcore\Model\Asset\Dao::getByPath PHP Метод

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

Get the data for the asset from database for the given path
public getByPath ( string $path )
$path string
    public function getByPath($path)
    {
        // check for root node
        $_path = $path != "/" ? dirname($path) : $path;
        $_path = str_replace("\\", "/", $_path);
        // windows patch
        $_key = basename($path);
        $_path .= $_path != "/" ? "/" : "";
        $data = $this->db->fetchRow("SELECT id FROM assets WHERE path = " . $this->db->quote($_path) . " and `filename` = " . $this->db->quote($_key));
        if ($data["id"]) {
            $this->assignVariablesToModel($data);
        } else {
            throw new \Exception("asset with path: " . $path . " doesn't exist");
        }
    }