annotations.rst 794 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. Annotations
  2. ===========
  3. All annotations require jms/di-extra-bundle, it can easily be installed by composer:
  4. .. code-block:: bash
  5. composer require jms/di-extra-bundle
  6. if you want to know more: http://jmsyst.com/bundles/JMSDiExtraBundle
  7. Define Admins
  8. ^^^^^^^^^^^^^
  9. All you have to do is include Sonata\AdminBundleAnnotations and define the values you need.
  10. .. code-block:: php
  11. <?php
  12. namespace AcmeBundle\Admin;
  13. use Sonata\AdminBundle\Admin\Admin;
  14. use Sonata\AdminBundle\Annotation as Sonata;
  15. /**
  16. * @Sonata\Admin(
  17. * class="AcmeBundle\Entity\MyEntity"
  18. * )
  19. */
  20. class MyAdmin extends Admin
  21. {
  22. }
  23. .. note::
  24. If you need to define custom controllers you can also use jms/di-extra-bundle by using
  25. the DI\Service annotation.