Guest User

Untitled

a guest
Jul 21st, 2018
160
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.48 KB | None | 0 0
  1. <?php
  2.  
  3. /*
  4. * This file is part of the Sonata package.
  5. *
  6. * (c) Thomas Rabaix <thomas.rabaix@sonata-project.org>
  7. *
  8. * For the full copyright and license information, please view the LICENSE
  9. * file that was distributed with this source code.
  10. */
  11.  
  12. namespace Sonata\BaseApplicationBundle\Admin;
  13.  
  14.  
  15. abstract class EntityAdmin extends Admin
  16. {
  17.  
  18. /**
  19. * return the entity manager
  20. *
  21. * @return EntityManager
  22. */
  23. public function getEntityManager()
  24. {
  25. return $this->container->get('doctrine.orm.default_entity_manager');
  26. }
  27.  
  28. /**
  29. * return the doctrine class metadata handled by the Admin instance
  30. *
  31. * @return ClassMetadataInfo the doctrine class metadata handled by the Admin instance
  32. */
  33. public function getClassMetaData()
  34. {
  35.  
  36. return $this->getEntityManager()
  37. ->getClassMetaData($this->getClass());
  38. }
  39.  
  40. /**
  41. * return the FormBuilder
  42. *
  43. * @return FormBuilder
  44. */
  45. public function getFormBuilder()
  46. {
  47. return $this->container->get('base_application.builder.orm_form');
  48. }
  49.  
  50. /**
  51. * return the ListBuilder
  52. *
  53. * @return ListBuilder
  54. */
  55. public function getListBuilder()
  56. {
  57. return $this->container->get('base_application.builder.orm_list');
  58. }
  59.  
  60. /**
  61. * return the FilterBuilder
  62. *
  63. * @return FilterBuilder
  64. */
  65. public function getDatagridBuilder()
  66. {
  67. return $this->container->get('base_application.builder.orm_datagrid');
  68. }
  69.  
  70. }
Add Comment
Please, Sign In to add comment