public function actionChangeState($hotelBookerId = 0, $newState = '') { if ($hotelBookerId) { /** @var HotelBookerComponent $hotelBookerComponent */ $hotelBookerComponent = new HotelBookerComponent(); $hotelBookerComponent->setHotelBookerFromId($hotelBookerId); echo "HotelBookerId " . $hotelBookerComponent->getHotelBookerId() . PHP_EOL; echo "Current status is " . $hotelBookerComponent->getCurrent()->swGetStatus() . PHP_EOL; echo "Next possible status are " . $hotelBookerComponent->getCurrent()->swGetNextStatus() . PHP_EOL; echo "Trying to change status to {$newState}" . PHP_EOL; if ($newState) { $res = $hotelBookerComponent->status($newState); if (!$res) { CVarDumper::dump($hotelBookerComponent->getCurrent()->getErrors()); CVarDumper::dump($hotelBookerComponent->getCurrent()->getAttributes()); echo PHP_EOL; } else { $hotelBookerComponent->getCurrent()->onlySave(); } echo "Status is " . $hotelBookerComponent->getCurrent()->swGetStatus() . "\n"; } } else { $helpText = $this->getHelp(); $helpText = str_replace('command', 'ChangeState', $helpText); echo $helpText; } }
public function transferMoney() { $bookingModel = $this->getOrderBooking(); /** @var FlightBooker[] $flightBookers */ $flightBookers = FlightBooker::model()->findAllByAttributes(array('orderBookingId' => $bookingModel->primaryKey)); foreach ($flightBookers as $flightBooker) { $status = $flightBooker->status; if (strpos($status, '/') !== false) { $status = substr($status, strpos($status, '/') + 1); } $flightBookerComponent = new FlightBookerComponent(); $flightBookerComponent->setFlightBookerFromId($flightBooker->id); $flightBookerComponent->status('transferMoney'); //$flightBooker->timeout; } $hotelBookers = HotelBooker::model()->findAllByAttributes(array('orderBookingId' => $bookingModel->primaryKey)); foreach ($hotelBookers as $hotelBooker) { $status = $hotelBooker->status; if (strpos($status, '/') !== false) { $status = substr($status, strpos($status, '/') + 1); } $hotelBookerComponent = new HotelBookerComponent(); $hotelBookerComponent->setHotelBookerFromId($hotelBooker->id); $hotelBookerComponent->status('transferMoney'); } }
public function actionTicketHotel($bookingId) { $booking = new HotelBookerComponent(); $booking->setHotelBookerFromId($bookingId); $booking->status('ticketing'); $this->redirect(array('view', 'id' => $booking->getCurrent()->orderBookingId)); }