Advertisement
seriy-coder

controller

Sep 29th, 2016
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.80 KB | None | 0 0
  1. namespace ShopBundle\Controller;
  2.  
  3.  
  4. use AppBundle\Entity\Stockroom;
  5. use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
  6. use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter;
  7. use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
  8. use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
  9. use Symfony\Component\HttpFoundation\Response;
  10. use UserBundle\Entity\UserClient;
  11.  
  12. /**
  13.  * Class BusinessShipmentController
  14.  * @Route("/shop/account/business/client")
  15.  * @package ShopBundle\Controller
  16.  */
  17. class BusinessShipmentController extends ShipmentController
  18. {
  19.     /**
  20.      * @Route("/{client_id}/table/{stockroom_id}", name="shop1_client_shipment_table", options={"expose" = true})
  21.      * @Method("GET")
  22.      * @ParamConverter("client", class="UserBundle:UserClient", options={"mapping" = { "client_id" = "id" }})
  23.      * @ParamConverter("stockroom", class="AppBundle:Stockroom", options={"mapping" = { "stockroom_id" = "id" }})
  24.      * @param UserClient $client
  25.      * @param Stockroom $stockroom
  26.      * @return Response
  27.      */
  28.     public function shipmentsClientTableAction(UserClient $client, Stockroom $stockroom)
  29.     {
  30.         $this->sessionSet(self::SESSION_STOCKROOM, $stockroom->getId());
  31.         $isConsolidationActive = $this->getUser()->isShopCountyConsolidationActive();
  32.         $template = $isConsolidationActive ?
  33.             'ShopBundle:BusinessShipment:shipmentTable.html.twig' :
  34.             'ShopBundle:BusinessShipment:shipmentTableSimple.html.twig';
  35.  
  36.         $response['shipments'] = $this->shipmentRepository->getShopShipments($stockroom, $client);
  37.  
  38.         if ($isConsolidationActive) {
  39.             $response['boxes'] = $this->combineRepository->getShopConsolidations($stockroom, $client);
  40.         }
  41.  
  42.         return $this->render($template, $response);
  43.     }
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement