public function getUpdated() { $this->__load(); return parent::getUpdated(); }
/** * Update feed * * @param Newscoop\Entity\Ingest\Feed $feed * @return void */ private function updateSDAFeed(Feed $feed) { foreach (glob($this->config['path'] . '/*.xml') as $file) { if ($feed->getUpdated() && $feed->getUpdated()->getTimestamp() > filectime($file) + self::IMPORT_DELAY) { continue; } if (time() < filectime($file) + self::IMPORT_DELAY) { continue; } $handle = fopen($file, 'r'); if (flock($handle, LOCK_EX | LOCK_NB)) { $parser = new NewsMlParser($file); if (!$parser->isImage()) { $entry = $this->getPrevious($parser, $feed); switch ($parser->getInstruction()) { case 'Rectify': case 'Update': $entry->update($parser); case '': if ($entry->isPublished()) { $this->updatePublished($entry); } else { if ($feed->isAutoMode()) { $this->publish($entry); } } $this->em->persist($entry); break; case 'Delete': $this->deletePublished($entry); $feed->removeEntry($entry); $this->em->remove($entry); break; default: throw new \InvalidArgumentException("Instruction '{$parser->getInstruction()}' not implemented."); break; } } flock($handle, LOCK_UN); fclose($handle); $this->em->flush(); } else { continue; } } $feed->setUpdated(new \DateTime()); $this->em->persist($feed); $this->getEntryRepository()->liftEmbargo(); $this->em->flush(); }