public function insert(FlightBooking $flightBooking) { $flightBooking->setId(null); $flightBooking->setStatus(FlightBooking::PENDING); $sql = ' INSERT INTO flight_bookings (id,first_name, last_name) VALUES (:id,:first_name, :last_name)'; return $this->execute($sql, $flightBooking); }
public static function map(FlightBooking $flightBooking, array $properties) { if (array_key_exists('id', $properties)) { $flightBooking->setId($properties['id']); } if (array_key_exists('first_name', $properties)) { $flightBooking->setFirstName($properties['first_name']); } if (array_key_exists('no_of_passengers', $properties)) { $flightBooking->setNoOfPassengers($properties['no_of_passengers']); } }
public function insert(FlightBooking $flightBooking) { //needs changing //$now = new DateTime(); $flightBooking->setId(null); //$flightBooking->setCreatedOn($now); //$flightBooking->setLastModifiedOn($now); $flightBooking->setStatus(FlightBooking::PENDING); $sql = ' INSERT INTO flight_bookings (id, first_name, no_of_passengers, status) VALUES (:id, :first_name, :no_of_passengers, :status)'; return $this->execute($sql, $flightBooking); }
public static function map(FlightBooking $flightBooking, array $properties) { if (array_key_exists('id', $properties)) { $flightBooking->setId($properties['id']); } if (array_key_exists('first_name', $properties)) { $flightBooking->setFirstName($properties['first_name']); } if (array_key_exists('no_of_passengers', $properties)) { $flightBooking->setNoOfPassengers($properties['no_of_passengers']); } if (array_key_exists('date', $properties)) { $formattedDate = $properties['date']; $date = self::createDateTime($formattedDate); if ($date) { $flightBooking->setDate($date); } } }