/** * * Set data from FlightVoyage object * @param FlightVoyage $flightVoyage * @throws CException */ public function setFromFlightVoyage(FlightVoyage $flightVoyage, $suffix) { if ($flightVoyage instanceof FlightVoyage) { $priceAttribute = "price" . $suffix; $transportAttribute = "transport" . $suffix; $validatorAttribute = "validator" . $suffix; $durationAttribute = "duration" . $suffix; $this->{$priceAttribute} = $flightVoyage->price; $this->{$transportAttribute} = $flightVoyage->getTransportAirlines(); $this->{$validatorAttribute} = $flightVoyage->valAirline->code; $this->{$durationAttribute} = $flightVoyage->getFullDuration(); } else { throw new CException(Yii::t('application', 'Required param type FlightVoyage')); } }