Beispiel #1
0
 /**
  * 
  * @param \Entity\Event $event
  * @return type
  */
 public function findByEvent($event)
 {
     $sql = 'SELECT description, equipment_id, time, create_timestamp, user_id, type FROM event ' . 'WHERE description = :description and ' . ' equipment_id = :equipment_id and ' . ' time = :time and ' . ' create_timestamp = :create_timestamp and ' . ' user_id = :user_id and ' . ' type = :type ';
     $stmt = $this->db->getConnection()->prepare($sql);
     $stmt->bindParam('equipment_id', $event->getEquipmentId());
     $stmt->bindParam('create_timestamp', $event->getTimestamp());
     $stmt->bindParam('user_id', $event->getUserId());
     $stmt->bindParam('type', $event->getType());
     $stmt->bindParam('time', $event->getTime());
     $stmt->execute();
     $result = $stmt->fetchAll(\PDO::FETCH_ASSOC);
     return $this->eventFactory($result);
 }
 public function transform(\Entity\Event $event)
 {
     return ['id' => (int) $event->getId(), 'equipment_id' => (int) $event->getEquipmentId(), 'user_id' => (int) $event->getUserId(), 'create_timestamp' => $event->getTimestamp(), 'description' => $event->getDescription(), 'type' => $event->getType(), 'time' => $event->getTime(), 'links' => ['rel' => 'self', 'uri' => \Util\SlimUtil::absoluteUrlFor('list_events_by_id', ['id' => $event->getId()]), 'method' => 'GET']];
 }