private function getAppointmentCalendar(\DateTime $period, \Application\RoomItem $room, \Core\Database $db, \DBMappers\AppointmentItem $appMapper) { $result = array(); $last_day = \Utility\DateHelper::GetLastDayInMonth($period); for ($i = 1; $i <= $last_day; $i++) { $query_date = \Utility\DateHelper::DateOfDay($period, $i); $result[$i] = $appMapper->getDayAppointments($room->getId(), $query_date, $db); } return $result; }
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); } }
/** * @depends testCreation * @param \Application\RoomItem $room */ public function testArrayFunctions(\Application\RoomItem $room) { $arr = $room->toArray(); $subset = array_merge(array(), self::$arrayToTest); $this->assertArraySubset($subset, $arr); }