Exemplo n.º 1
0
 private function fetchEntities()
 {
     if (!is_array($this->entitiesByMessageId)) {
         $this->entitiesByMessageId = $this->dbGateway->fetchEntitiesForEntries($this->data);
     }
     return $this->entitiesByMessageId;
 }
Exemplo n.º 2
0
 /**
  * @return bool|int
  */
 public function getId()
 {
     $id = $this->getIdFromSignedCookie();
     if (false === $id) {
         $ipAddress = $this->request->getClientIp();
         $geocoderResult = null;
         if ($this->geocoder) {
             try {
                 $geocoderResult = $this->geocoder->geocode($ipAddress)->first();
             } catch (NoResultException $e) {
             }
         }
         $id = $this->dbGateway->insertUserInformation($ipAddress, $_SERVER['HTTP_USER_AGENT'], php_sapi_name(), $geocoderResult);
         $this->writeSignedCookie($id);
     }
     return $id;
 }
Exemplo n.º 3
0
 private function fetchEntries()
 {
     if (!is_array($this->entries)) {
         $select = $this->select();
         $driver = $select->getAdapter()->getDriver();
         $driver->prepareSelectForTotalRowCalculation($select);
         $this->entries = $this->dbGateway->getAdapter()->fetchAll($select);
         $this->totalCount = $driver->fetchTotalRowCount($this->entries);
     }
     return $this->entries;
 }
Exemplo n.º 4
0
 public function log($summary, $message)
 {
     $shortcodes = $this->shortcodeParser->parse($message);
     $entities = [];
     foreach ($shortcodes as $shortcode) {
         if (!$shortcode->hasParameter('id') || !$shortcode->getParameter('id')) {
             throw new InvalidShortcodeException("Shortcode does not contain required 'id' parameter: {$shortcode->getText()}.");
         }
         $name = $shortcode->getName();
         $handler = $this->handler($name);
         $id = $shortcode->getParameter('id');
         $titleText = $handler->renderTitleText($id);
         $entities[] = ['handler' => $handler->getFullyQualifiedName(), 'title_text' => $titleText, 'primary_key_value' => $id];
     }
     $this->dbGateway->insertEntry($summary, $message, $entities, $this->getUserInformationId());
     return $this;
 }