/** * Creates a {@link Booking} object from array data without saving it. * * @param array $bookingItem An associative array with data that can be * passed to {@link Booking::fromArray()}. * @param array $bookingTypeIds An associative array with booking type IDs * (in the keys) to allow. * @return Booking The created booking. */ private function createBooking(array $bookingItem, array $bookingTypeIds, PropelPDO $con) { $booking = new Booking(); $booking->fromArray(array_intersect_key($bookingItem, array('BookingTypeId' => true, 'Label' => true, 'Value' => true))); $bookingTypeId = $booking->getBookingTypeId(); if (empty($bookingTypeIds[$bookingTypeId])) { throw new Exception('Invalid booking type ID #' . $bookingTypeId . ' specified for booking: ' . json_encode($bookingItem)); } return $booking; }
/** * Filter the query by a related Booking object * * @param Booking|PropelObjectCollection $booking the related object to use as filter * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * * @return BookingTypeQuery The current query, for fluid interface * @throws PropelException - if the provided filter is invalid. */ public function filterByBooking($booking, $comparison = null) { if ($booking instanceof Booking) { return $this->addUsingAlias(BookingTypePeer::ID, $booking->getBookingTypeId(), $comparison); } elseif ($booking instanceof PropelObjectCollection) { return $this->useBookingQuery()->filterByPrimaryKeys($booking->getPrimaryKeys())->endUse(); } else { throw new PropelException('filterByBooking() only accepts arguments of type Booking or PropelCollection'); } }