상속: extends AbstractEntity
예제 #1
0
 /**
  * Fetch item metadata
  *
  * @param string $key
  * @return object
  */
 public function fetchMetadata($key)
 {
     $item = $this->storage->getItem($key);
     $metadata = array('key' => $item->getKey(), 'name' => $item->getName(), 'type' => $item->getType(), 'realpath' => $this->storage->getRealpath($key));
     if (!$item->isDir()) {
         $metadata += array('size' => $item->getSize(), 'ctime' => $item->getChangeTime());
         if ($metadata['type'] == 'tpl') {
             $template = $this->repository->getTemplate($key, false);
             // get the resource for the template id
             $resource = $this->syncResServ->findByPathOrId(rtrim($this->theme->getPath(), "/") . "/" . ltrim($key, "/"));
             /* @var $resource Newscoop\Entity\Resource */
             $metadata += array('id' => is_object($resource) ? $resource->getId() : $template->getId(), 'ttl' => $template->getCacheLifetime());
         }
     }
     return (object) $metadata;
 }
 /**
  * Get the publication of a theme, and optionally output
  * @param Theme $theme
  * @param Output $output
  * @return Publication
  */
 function getThemePublication($theme, $output = null)
 {
     $pathRsc = $this->getSyncResourceService()->getThemePath($theme->getPath());
     $em = $this->getEntityManager();
     $qb = $em->createQueryBuilder();
     $qb->select('th')->from(OutputSettingsTheme::NAME, 'th');
     $qb->where('th.themePath = :themePath');
     $qb->setParameter('themePath', $pathRsc);
     if (!is_null($output)) {
         $qb->andWhere('th.output = :output');
         $qb->setParameter('output', $output);
     }
     $result = current($qb->getQuery()->getResult());
     if ($result) {
         return $result->getPublication();
     }
     return null;
 }
예제 #3
0
 public function setId($id)
 {
     $this->__load();
     return parent::setId($id);
 }
 /**
  * Provides the full path for a theme.
  *
  * @param Theme|string $theme
  * 		The Theme or path, *(not null not empty).
  * @param string $file
  * 		Optional a file to be appended to the path.
  * @return string
  * 		The full path to the theme and file if is the case.
  */
 public function toFullPath($theme, $file = '')
 {
     if ($theme instanceof Theme) {
         return $this->themesFolder . $theme->getPath() . $file;
     }
     return $this->themesFolder . $theme . $file;
 }