コード例 #1
0
 /**
  * @param  ArticleTemplateInterface $articleTemplate
  * @param  OutletTemplateInterface  $outletTemplate
  * @param  OutputInterface          $output
  *
  * @return bool
  */
 protected function processArticleTemplateAndSaveData(ArticleTemplateInterface $articleTemplate, OutletTemplateInterface $outletTemplate, OutputInterface $output)
 {
     $output->writeln(sprintf('<comment>[+] %s - Synchronizing the article "%s" posted by "%s" at "%s" ...</comment>', date('Y-m-d H:i:s'), $articleTemplate->getTitle(), $articleTemplate->getAuthor()->getName(), $articleTemplate->getPublicationDate()->format('Y-m-d')));
     $dataMapper = new GenericDataMapper($articleTemplate, $outletTemplate, $this->getResourceManager('article'), $this->getResourceManager('author'), $this->getResourceManager('outlet'));
     $resourceId = $dataMapper->save();
     if ($resourceId !== false) {
         $output->writeln(sprintf('<info>[+] %s - The article #%d was synchronized with successfully ...</info>', date('Y-m-d H:i:s'), $resourceId));
     } else {
         $output->writeln(sprintf('<error>[+] %s - The article was not synchronized ...</error>', date('Y-m-d H:i:s')));
     }
     return $resourceId;
 }
コード例 #2
0
 public function testGetLink()
 {
     $this->assertInstanceOf('\\Cekurte\\WebScrapingBundle\\Template\\Core\\LinkTemplateInterface', $this->article->getLink());
 }