Example #1
0
 /**
  * Process a HTTP request.
  *
  * <p>This implementation will delegate request handling based on the method parameter in
  * the request. If no method is found, the default <em>parent</em> <code>process()</code> implementation
  * will be called.</p>
  *
  * <p>Also, if the passed method is not found, the controller will try to resolve the method by appending the
  * configured <em>ajaxFormat</em> string. So, if, for example, the method is <code>getCountries</code> and <em>ajaxFormat</em> is
  * <code>JSON</code>, the controller will first look for <code>getCountries</code> and then for <code>getCountriesJSON</code>.</p>
  *
  * @return View A <code>View</code> instance or <code>null</code>.
  */
 public function processAction(Request $request)
 {
     $method = $sacsMethod = $request->getParameter('method');
     if (!method_exists($this, $method)) {
         $method = $method . 'JSON';
     }
     $sacsManager = $this->container->get('sacsManager');
     // check access on controller level
     $sacsManager->authorize($request, $request->getRequestId(), $this->getUser());
     // (re-)check on method level if mapping exists
     $methodRequestId = $request->getRequestId() . '#' . $sacsMethod;
     if ($sacsManager->hasMappingForRequestId($methodRequestId)) {
         $sacsManager->authorize($request, $methodRequestId, $this->getUser());
     }
     if (method_exists($this, $method) || in_array($method, $this->getAttachedMethods())) {
         $this->{$method}($request);
         return null;
     }
     return parent::processAction($request);
 }
 /**
  * Show.
  */
 public function showAction($cID, Request $request, Session $session)
 {
     $coupon = $this->container->get('couponService')->getCouponForId($request->getParameter('cID'), $session->getLanguageId());
     return new ModelAndView(null, array('coupon' => $coupon));
 }