コード例 #1
0
ファイル: Reservation.php プロジェクト: edderrd/Aerocal
 /**
  * Add a new reservation
  *
  * @param array $data
  * @return int
  */
 public static function addReservation($data)
 {
     if (!empty($data)) {
         $r = new Reservation();
         $r->start_date = $data['startDate'];
         $r->end_date = $data['endDate'];
         $r->User = Doctrine::getTable("User")->find($data['user_id']);
         $r->Aircraft = Doctrine::getTable("Aircraft")->find($data['aircraft']);
         $r->status_id = 1;
         $r->save();
         $r->refresh();
         return $r->id;
     }
 }