Пример #1
0
 public function transform(\Entity\Equipment $equipment)
 {
     return ['equipment_id' => (int) $equipment->getEquipmentId(), 'area_id' => (int) $equipment->getAreaId(), 'name' => $equipment->getName(), 'links' => ['rel' => 'self', 'uri' => \Util\SlimUtil::absoluteUrlFor('equipment_by_id', ['id' => $equipment->getEquipmentId()]), 'method' => 'GET']];
 }
Пример #2
0
 /**
  * 
  * @param \Entity\Equipment $equipment
  */
 public function findEquipmentInserted($equipment)
 {
     $sql = 'SELECT * FROM equipment WHERE name = :name and area_id = :area_id ';
     $stmt = $this->db->getConnection()->prepare($sql);
     $stmt->bindParam('name', $equipment->getName());
     $stmt->bindParam('area_id', $equipment->getAreaId());
     $stmt->execute();
     $result = $stmt->fetchAll(\PDO::FETCH_ASSOC);
     $equipments = $this->equipmentFactory($result);
     if (count($equipments) < 1) {
         return false;
     }
     return $equipments;
 }