public function executeAjxCheckBooking(sfWebRequest $request) { // To use url_for() helper ... // $this->getContext()->getConfiguration()->loadHelpers('Url'); $app = Doctrine_Core::getTable('Apartment')->find($request->getPostParameter('apid')); $booking = new Booking(); $booking->date_from = $request->getPostParameter('start_date'); $booking->date_to = date("Y-m-d", strtotime($request->getPostParameter('start_date')) + 86400 * ($request->getParameter('days') + 1)); $booking->CheckBookingPossibility($app, $request->getPostParameter('pax')); if ($request->isXmlHttpRequest()) { if ($this->getUser()->isAuthenticated() && is_object($booking)) { /* Forward to action */ $this->forward('booking', 'NewBooking'); } else { $form = new BookingForm(); $form->PublicBookingForm($app); $callback_url = 'http://localhost/symfonybooking/web/frontend_dev.php/en/apartment/' . $app->getId(); return $this->renderPartial('booking/booking_form', array('form' => $form, 'sign_in' => true, 'callback' => $callback_url)); } } else { return sfView::NONE; /* Log this !*/ } }