Newscoop\Entity\Resource::setPath PHP Метод

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

Set the path of the resource.
public setPath ( string $path ) : Newscoop\Entity\Resource
$path string The path of the resource.
Результат Newscoop\Entity\Resource This object for chaining purposes.
    function setPath($path)
    {
        Validation::notEmpty($path, 'path');
        $this->path = str_replace('\\', '/', $path);
        return $this;
    }

Usage Example

Пример #1
0
 public function __construct($p_templateIdOrName = null, $p_themePath = null)
 {
     $this->m_properties = array();
     $this->m_customProperties['name'] = 'getValue';
     $this->m_customProperties['identifier'] = 'getId';
     $this->m_customProperties['type'] = 'getTemplateType';
     $this->m_customProperties['defined'] = 'defined';
     $this->m_customProperties['theme_dir'] = 'getThemeDir';
     $this->_map = array("frontPage" => "issue", "errorPage" => "default", "sectionPage" => "section", "issuePage" => "issue", "articlePage" => "article");
     if ((is_string($p_templateIdOrName) || is_int($p_templateIdOrName)) && !empty($p_templateIdOrName)) {
         $filePath = is_numeric($p_templateIdOrName) ? $p_templateIdOrName : $p_themePath . $p_templateIdOrName;
         $resourceId = new ResourceId('template_engine/metaclasses/MetaTemplate');
         /* @var $syncResourceService ISyncResourceService */
         $syncResourceService = $resourceId->getService(ISyncResourceService::NAME);
         $this->m_dbObject = $syncResourceService->findByPathOrId($filePath);
         if (is_null($this->m_dbObject)) {
             $pathRsc = new Resource();
             $pathRsc->setName('buildPage');
             $filePath = CS_PATH_TEMPLATES . DIR_SEP . $p_themePath . $p_templateIdOrName;
             if (!is_numeric($p_templateIdOrName) && !is_null($p_themePath) && file_exists($filePath)) {
                 $pathRsc->setPath($p_themePath . $p_templateIdOrName);
                 $this->m_dbObject = $syncResourceService->getSynchronized($pathRsc);
             } else {
                 $this->m_dbObject = $pathRsc;
             }
         }
     }
 }
All Usage Examples Of Newscoop\Entity\Resource::setPath