public function getApartmentsInRegistrationProcessCount() { /* @var $apartmentsDao \DDD\Dao\Apartment\General */ $apartmentsDao = new \DDD\Dao\Apartment\General($this->getServiceLocator()); $count = $apartmentsDao->getApartmentsInRegistrationProcessCount(); return $count; }
/** * @param $apartmentGroupId * @param $from * @param $to * @param int $roomCount * @param $sort * @param $roomType * @return array */ public function composeGroupAvailabilityForDateRange($apartmentGroupId, $from, $to, $roomCount = -1, $sort, $roomType) { /** * @var \DDD\Domain\Apartment\Inventory\GroupInventory[] $resultSet * @var \DDD\Dao\Booking\Booking $reservationDao */ $dateValidator = new Date(['format' => 'Y-m-d']); if ($dateValidator->isValid($from) && $dateValidator->isValid($to)) { $apartmentService = $this->getServiceLocator()->get('service_apartment_general'); $apartmentDao = new \DDD\Dao\Apartment\General($this->getServiceLocator(), 'DDD\\Domain\\Apartment\\Inventory\\GroupInventory'); $reservationDao = $this->getServiceLocator()->get('dao_booking_booking'); $overbookings = $reservationDao->getApartmentGroupOverbookingsForDateRange($apartmentGroupId, $from, $to, $roomCount, $roomType); $result = []; $dates = []; $existingDates = []; $resultSet = $apartmentDao->getGroupAvailabilityForDateRange($apartmentGroupId, $from, $to, $roomCount, $sort, $roomType); foreach ($resultSet as $row) { $apartmentId = $row->getId(); $date = $row->getDate(); if (!in_array($date, $existingDates)) { array_push($existingDates, $date); array_push($dates, ['raw' => $date, 'dayOfWeek' => date('D', strtotime($date)), 'day' => date('j', strtotime($date)), 'month' => date('n', strtotime($date))]); } if (isset($result[$apartmentId])) { $result[$apartmentId][$date] = ['av' => $row->getAvailability(), 'reservation_data' => $row->getReservationData()]; } else { $balcony = !is_null($row->getAmenityId()) ? ' (B)' : ''; $bedroom = $row->getBedroom_count() . $balcony; $result[$apartmentId] = ['id' => $row->getId(), 'name' => $row->getName(), 'floor' => $row->getFloor(), 'block' => $row->getBlock(), 'bedroom' => $bedroom, 'bathroom' => $row->getBathroom_count(), 'max_capacity' => $row->getMax_capacity(), 'unit_number' => $row->getUnit_number(), 'building_name' => $row->getBuildingName(), 'links' => $apartmentService->getWebsiteLink($row->getId()), $row->getDate() => ['av' => $row->getAvailability(), 'reservation_data' => $row->getReservationData()]]; } } if (!empty($result)) { $result = array_values($result); } sort($dates); return ['list' => $result, 'days' => $dates, 'overbookings' => $overbookings]; } else { return ['list' => [], 'days' => [], 'overbookings' => []]; } }
public function getMaxCapacity($apartmentId) { $generalDao = new \DDD\Dao\Apartment\General($this->getServiceLocator()); $response = $generalDao->getMaxCapacity($apartmentId); return $response['max_capacity']; }
/** * @param int $apartmentId */ public function setApartmentID($apartmentId) { $this->apartmentId = $apartmentId; $apartmentGeneralDao = new \DDD\Dao\Apartment\General($this->getServiceLocator(), 'ArrayObject'); $this->apartmentStatus = $apartmentGeneralDao->getStatusID($apartmentId)['status']; }