コード例 #1
0
ファイル: RoomItem.php プロジェクト: anddorua/boardroom
 public function save(\Application\RoomItem $room, \Core\Database $db)
 {
     $fields_to_save = $room->toArray();
     unset($fields_to_save[$room->getIdFieldName()]);
     if (is_null($room->getId()) || $room->getId() == '') {
         $this->makeInsertQuery('rooms', $fields_to_save, $db);
         $lid = $db->getLastInsertId();
         $room->fromArray(array($room->getIdFieldName() => $lid));
     } else {
         $this->makeUpdateQuery('rooms', $fields_to_save, array('id' => $room->getId()), $db);
     }
 }