Advertisement
Guest User

Untitled

a guest
Aug 5th, 2015
168
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. <?php
  2.  
  3. namespace AppBundle\Controller;
  4.  
  5.  
  6. use Symfony\Bundle\FrameworkBundle\Controller\Controller;
  7.  
  8. class BaseGalleryController extends Controller
  9. {
  10. /**
  11. * Shortcut to return the JMSSerializer service.
  12. *
  13. * @return object The service
  14. *
  15. * @throws \LogicException If JMSSerializerBundle is not available
  16. */
  17. public function getSerializer()
  18. {
  19. if (!$this->container->has('jms_serializer')) {
  20. throw new \LogicException('The JMSSerializerBundle is not registered in your application.');
  21. }
  22.  
  23. return $this->container->get('jms_serializer');
  24. }
  25.  
  26. // ... another shortcuts, if needed
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement