示例#1
0
 public function getHandler(ContentHandler $contentHandler)
 {
     if (!isset($this->handlers[$contentHandler->getId()])) {
         $class = $contentHandler->getClass();
         if (!class_exists($class)) {
             throw new \RuntimeException($class . ' not found when trying to create handler.');
         }
         if (strpos(get_class($contentHandler), 'Proxies') === 0) {
             $contentHandler = $this->get('nyrocms_db')->getContentHandlerRepository()->find($contentHandler->getId());
         }
         $this->handlers[$contentHandler->getId()] = new $class($contentHandler, $this->container);
     }
     return $this->handlers[$contentHandler->getId()];
 }
示例#2
0
 public function getTotalContentSpec(Content $content = null, $state = ContentSpec::STATE_ACTIVE)
 {
     return $this->getContentSpecRespository()->countForHandler($this->contentHandler->getId(), $state, $this->hasContentSpecificContent() ? $content : null);
 }