Pimcore\Model\Site::getRootPath PHP Method

getRootPath() public method

public getRootPath ( ) : string
return string
    public function getRootPath()
    {
        if (!$this->rootPath && $this->getRootDocument()) {
            return $this->getRootDocument()->getRealFullPath();
        }
        return $this->rootPath;
    }

Usage Example

 /**
  * @param Site $site
  * @param Document $document
  * @return int
  */
 public function getDocumentIdFromHardlinkInSameSite(Site $site, Document $document)
 {
     return $this->db->fetchOne("SELECT documents.id FROM documents\n            LEFT JOIN documents_hardlink ON documents.id = documents_hardlink.id\n            WHERE documents_hardlink.sourceId = ? AND documents.path LIKE ?", array($document->getId(), $site->getRootPath() . "/%"));
 }