/**
  * @param FeedTypeInterface $type
  *
  * @return FeedWriter
  */
 public function createWriter(FeedTypeInterface $type)
 {
     return new FeedWriter($this->templating, $type->getRootNode(), $type->getItemNode());
 }
Example #2
0
 /**
  * @param FeedTypeInterface $type
  *
  * @return string
  */
 protected function getTemplateHash(FeedTypeInterface $type)
 {
     if (!array_key_exists($type->getName(), $this->templateHashes)) {
         // concatenate all variables that can change the template in the hash
         $hash = $type->getRootNode() . $type->getItemNode();
         // use the canonical path if we're using a template reference, otherwise just use the template name
         $template = $type->getTemplate();
         if ($template instanceof TemplateReferenceInterface && file_exists($template->getPath())) {
             $hash .= md5_file($template->getPath());
         } else {
             $hash .= $template;
         }
         $this->templateHashes[$type->getName()] = md5($hash);
     }
     return $this->templateHashes[$type->getName()];
 }