Exemplo n.º 1
0
 public function update($flightArray)
 {
     $flight = Flight::fromArray($flightArray);
     try {
         return $this->mapper->update($flight);
     } catch (Exception $e) {
         $this->handleException($e);
     }
 }
Exemplo n.º 2
0
 /**
    helper method to create an instance of a flight object from
    an array of key/value pairs (a decoded JSON object).
 */
 public static function fromArray($array)
 {
     $flight = new Flight();
     $flight->setId($array['id']);
     if (array_key_exists('userId', $array)) {
         $flight->setUserId($array['userId']);
     }
     $flight->setDate($array['date']);
     $flight->setAircraft($array['aircraft']);
     $flight->setTailNumber($array['tailNumber']);
     $flight->setDeparturePoint($array['departurePoint']);
     $flight->setArrivalPoint($array['arrivalPoint']);
     $flight->setSel($array['singleEngineLand']);
     $flight->setMel($array['multiEngineLand']);
     $flight->setRotorcraft($array['rotorcraft']);
     $flight->setDualReceived($array['dualReceived']);
     $flight->setPilotInCommand($array['pilotInCommand']);
     $flight->setSecondInCommand($array['secondInCommand']);
     $flight->setasFlightInstructor($array['asFlightInstructor']);
     $flight->setDay($array['day']);
     $flight->setNight($array['night']);
     $flight->setCrossCountry($array['crossCountry']);
     $flight->setActualInstrument($array['actualInstrument']);
     $flight->setSimulatedInstrument($array['simulatedInstrument']);
     $flight->setInstrumentApproach($array['instrumentApproach']);
     $flight->setDayLandings($array['dayLandings']);
     $flight->setNightLandings($array['nightLandings']);
     $flight->setTotal($array['total']);
     $flight->setCfiName($array['cfiName']);
     $flight->setCfiNumber($array['cfiNumber']);
     $flight->setNotes($array['notes']);
     return $flight;
 }