Esempio n. 1
0
<?php

chdir(dirname(__DIR__ . '/../../../../'));
require 'init_autoloader.php';
//BOOTSTRAP
//	bootstrap the application.
//	this has to be done to get all configs
$sm = Zend\Mvc\Application::init(require 'config/application.config.php')->bootstrap()->getServiceManager();
$pdo = $sm->get('PDO');
$index = $sm->get('Search\\Index\\Search');
//Event
//	index event entries.
//
$counter = 0;
$eventService = new Stjornvisi\Service\Event($pdo);
$events = $eventService->fetchAll();
$adapter = new Zend\Progressbar\Adapter\Console();
echo "\nIndexing Event entries\n";
$progressBar = new Zend\ProgressBar\ProgressBar($adapter, $counter, count($events));
$i = new Stjornvisi\Search\Index\Event();
foreach ($events as $item) {
    $i->index($item, $index);
    $progressBar->update(++$counter);
}
$index->commit();
$progressBar->finish();
//NEWS
//	index news entries.
//
$counter = 0;
$newsService = new Stjornvisi\Service\News($pdo);
Esempio n. 2
0
 /**
  * @param int $eventId
  * @return bool|\stdClass|\Stjornvisi\Service\Event
  * @throws NotifyException
  * @throws \Stjornvisi\Service\Exception
  */
 private function getEvent($eventId)
 {
     $event = new \Stjornvisi\Service\Event();
     $event->setDataSource($this->getDataSourceDriver())->setEventManager($this->getEventManager());
     //EVENT
     //	first of all, find the event in question
     if (($event = $event->get($eventId)) != false) {
         return $event;
     } else {
         throw new NotifyException("Event [{$eventId}] not found");
     }
 }