/**
  * Calls the parent createQuery() method and replaces the created
  * query with an OverlayQuery.
  *
  * @return \Int\NewsSlideit\Persistence\OverlayQuery
  */
 public function createQuery()
 {
     $query = parent::createQuery();
     /** @noinspection PhpMethodParametersCountMismatchInspection */
     $overlayQuery = $this->objectManager->get(OverlayQuery::class, $this->objectType);
     $overlayQuery->setQuerySettings($query->getQuerySettings());
     return $overlayQuery;
 }
Example #2
0
 /**
  * @param array $queueItem
  * @param array $importItemOverwrite
  * @return void
  */
 protected function importL10nOverlay(array $queueItem, array $importItemOverwrite)
 {
     $importItem = $queueItem['importItem'];
     $parentNews = $this->newsRepository->findOneByImportSourceAndImportId($importItem['import_source'], $importItem['l10n_parent']);
     if ($parentNews !== NULL) {
         $news = $this->initializeNewsRecord($importItem);
         $this->hydrateNewsRecord($news, $importItem, $importItemOverwrite);
         $news->setSysLanguageUid($importItem['sys_language_uid']);
         $news->setL10nParent($parentNews->getUid());
     }
 }
Example #3
0
 /**
  * Test if latest limit constraint works
  *
  * @test
  * @return void
  */
 public function findLatestLimitRecords()
 {
     /** @var $demand \GeorgRinger\News\Domain\Model\Dto\NewsDemand */
     $demand = $this->objectManager->get('GeorgRinger\\News\\Domain\\Model\\Dto\\NewsDemand');
     $demand->setStoragePage(9);
     $GLOBALS['EXEC_TIME'] = strtotime('2014-04-03');
     // get all news maximum 6 days old
     $demand->setTimeRestriction(6 * 86400);
     $this->assertEquals((int) $this->newsRepository->findDemanded($demand)->count(), 4);
     // no restriction should get you all
     $demand->setTimeRestriction(0);
     $this->assertEquals((int) $this->newsRepository->findDemanded($demand)->count(), 6);
 }
 /**
  * Displays the search result
  *
  * @param \GeorgRinger\News\Domain\Model\Dto\Search $search
  * @param array $overwriteDemand
  * @return void
  */
 public function searchResultAction(\GeorgRinger\News\Domain\Model\Dto\Search $search = NULL, array $overwriteDemand = array())
 {
     $demand = $this->createDemandObjectFromSettings($this->settings);
     if ($this->settings['disableOverrideDemand'] != 1 && $overwriteDemand !== NULL) {
         $demand = $this->overwriteDemandObject($demand, $overwriteDemand);
     }
     if (!is_null($search)) {
         $search->setFields($this->settings['search']['fields']);
         $search->setDateField($this->settings['dateField']);
     }
     $demand->setSearch($search);
     $assignedValues = array('news' => $this->newsRepository->findDemanded($demand), 'overwriteDemand' => $overwriteDemand, 'search' => $search, 'demand' => $demand);
     $this->emitActionSignal('NewsController', self::SIGNAL_NEWS_SEARCHRESULT_ACTION, $assignedValues);
     $this->view->assignMultiple($assignedValues);
 }
 /**
  * Test if by import source is done
  *
  * @test
  * @return void
  */
 public function findRecordsByTags()
 {
     /** @var \GeorgRinger\News\Domain\Model\Dto\NewsDemand $demand */
     $demand = $this->objectManager->get('GeorgRinger\\News\\Domain\\Model\\Dto\\NewsDemand');
     $demand->setStoragePage(10);
     $demand->setOrder('uid');
     $demand->setOrderByAllowed('uid');
     // given is 1 tag
     $demand->setTags('3');
     $news = $this->newsRepository->findDemanded($demand);
     $this->assertEquals('130,131', $this->getIdListOfNews($news));
     // given are 2 tags
     $demand->setTags('1,5');
     $news = $this->newsRepository->findDemanded($demand);
     $this->assertEquals('130,133,134', $this->getIdListOfNews($news));
     // given are 3 real tags & 1 not existing
     $demand->setTags('5,3,1,10');
     $news = $this->newsRepository->findDemanded($demand);
     $this->assertEquals('130,131,133,134', $this->getIdListOfNews($news));
 }