/**
  * Zapisuje rekord do dziennika.
  * 
  * @todo Użyj QueryBuilder
  * @todo Lokalizacja daty $logRecord['datetime']->format('Y-m-d H:i:s');
  * @param array $logRecord Rekord dziennika
  * @throws RuntimeException Rekord nie został zapisany
  * @throws \Doctrine\DBAL\DBALException Problem z zapisem rekordu
  */
 protected function write(array $logRecord)
 {
     $record = [];
     $record['id'] = null;
     $record['user_id'] = $logRecord['extra']['userid'];
     $record['channel'] = $logRecord['channel'];
     $record['level'] = $logRecord['level'];
     $record['level_name'] = $logRecord['level_name'];
     $record['message'] = $logRecord['formatted'];
     $record['viewed'] = 1;
     $record['extended_message'] = $logRecord['extra']['extended'];
     $record['created'] = $logRecord['datetime']->format('Y-m-d H:i:s');
     $insertResult = $this->connection->insert(self::TABLE_NAME, $record);
     if ($insertResult != 1) {
         throw new RuntimeException('Handling log record failed');
     }
 }
Example #2
0
 public function save(Zadanie $zadanie)
 {
     $zadanieData = array('nazov' => $zadanie->getNazov(), 'trieda_id' => $zadanie->getTriedaId(), 'pouzivatel_id' => $zadanie->getPouzivatelId(), 'predmet_id' => $zadanie->getPredmetId(), 'stav' => $zadanie->getStav(), 'cas_uzatvorenia' => $zadanie->getCasUzatvorenia());
     if ($zadanie->getId()) {
         $this->db->update('zadania', $zadanieData, array('zadanie_id' => $zadanie->getId()));
     } else {
         $this->db->insert('zadania', $zadanieData, array(PDO::PARAM_STR, PDO::PARAM_INT, PDO::PARAM_INT, PDO::PARAM_INT, PDO::PARAM_INT, 'datetime'));
         $id = $this->db->lastInsertId();
         $zadanie->setId($id);
     }
 }
 private function getRevisionId()
 {
     if ($this->revisionId === null) {
         $date = date_create("now")->format($this->platform->getDateTimeFormatString());
         if ($this->config->getCurrentUser() != null) {
             $userId = $this->config->getCurrentUser()->getId();
         } else {
             $userId = null;
         }
         $this->conn->insert($this->config->getRevisionTableName(), array('timestamp' => $date, 'user_id' => $userId, 'note' => $this->config->getNote(), 'ipaddress' => $this->config->getIpAddress()));
         $sequenceName = $this->platform->supportsSequences() ? 'REVISIONS_ID_SEQ' : null;
         $this->revisionId = $this->conn->lastInsertId($sequenceName);
     }
     return $this->revisionId;
 }
 public function addModel($modelId, $namespace)
 {
     common_Logger::d('add modelid :' . $k . ' with NS :' . $v);
     $this->connection->insert("models", array('modelid' => $k, 'modeluri' => $v));
 }
Example #5
0
 /**
  * @Given /^data was loaded independantley of Phabric$/
  */
 public function dataWasLoadedIndependantleyOfPhabric()
 {
     $data = array('name' => 'PBC11', 'datetime' => '2011-10-28 09:00:00', 'venue' => 'Barcellona', 'description' => 'HOT conf');
     $db = self::$db->insert('event', $data);
 }