コード例 #1
0
 /**
  * Read the feed from remote source using owner.FeedMeLinkFieldName and
  * owner.FeedMeFeedType. Return feed item Traversable with items mapped to
  * domain model, for example a FeedMeAtomFeedIterator for an atom feed.
  *
  * @return \FeedMeFeedInterface
  * @throws \FeedMeException
  */
 protected function feed()
 {
     $url = $this->getFeedURL();
     $xpath = $this->getFeedXPath() ?: $this->defaultXPath();
     $feedClass = $this->feedClassName();
     if ($url && $xpath && $feedClass) {
         $itemModel = Injector::inst()->get('FeedMeItemModel');
         $fieldMap = $itemModel->fieldMap();
         return Injector::Inst()->create($feedClass, $url, $xpath, $fieldMap);
     } else {
         throw new FeedMeException(_t("FeedMe.MissingInfoException", 'Missing info for feed {title}', ['title' => $this->owner->Title]));
     }
 }