console.rst 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. Console/Command-Line Commands
  2. =============================
  3. SonataAdminBundle provides the following console commands:
  4. * ``cache:create-cache-class``
  5. * ``sonata:admin:generate``
  6. * ``sonata:admin:explain``
  7. * ``sonata:admin:list``
  8. * ``sonata:admin:setup-acl``
  9. cache:create-cache-class
  10. ------------------------
  11. The ``cache:create-cache-class`` command generates the cache class
  12. (``app/cache/...env.../classes.php``) from the classes.map file.
  13. Usage example:
  14. .. code-block:: bash
  15. php app/console cache:create-cache-class
  16. sonata:admin:generate
  17. --------------------
  18. The ``sonata:admin:generate`` command generates a new Admin class based on the given model
  19. class, registers it as a service and potentially creates a new controller.
  20. As an argument you need to specify the fully qualified model class.
  21. All passed arguments and options are used as default values in interactive mode.
  22. You can disable the interactive mode with ``--no-interaction`` option.
  23. Options are:
  24. * ``bundle``: the bundle name (the default value is determined by the given model class, e.g. "YourNSFooBundle")
  25. * ``admin``: the admin class basename (by default this adds "Admin" to the model class name, e.g. "BarAdmin")
  26. * ``controller``: the controller class basename (by default this adds "AdminController" to the model class name, e.g. "BarAdminController")
  27. * ``manager``: the model manager type (by default this is the first registered model manager type, e.g. "orm")
  28. * ``services``: the services YAML file (the default value is "services.yml" or "admin.yml" if it already exist)
  29. * ``id``: the admin service ID (the default value is combination of the bundle name and admin class basename like "your_ns_foo.admin.bar")
  30. Usage example:
  31. .. code-block:: bash
  32. php app/console sonata:admin:generate YourNS\FooBundle\Entity\Bar
  33. sonata:admin:list
  34. -----------------
  35. To see which admin services are available use the ``sonata:admin:list`` command.
  36. It prints all the admin service ids available in your application. This command
  37. gets the ids from the ``sonata.admin.pool`` service where all the available admin
  38. services are registered.
  39. Usage example:
  40. .. code-block:: bash
  41. php app/console sonata:admin:list
  42. .. figure:: ../images/console_admin_list.png
  43. :align: center
  44. :alt: List command
  45. :width: 700px
  46. List command
  47. sonata:admin:explain
  48. --------------------
  49. The ``sonata:admin:explain`` command prints details about the admin of a model.
  50. As an argument you need to specify the admin service id of the Admin to explain.
  51. Usage example:
  52. .. code-block:: bash
  53. php app/console sonata:admin:explain sonata.news.admin.post
  54. .. figure:: ../images/console_admin_explain.png
  55. :align: center
  56. :alt: Explain command
  57. :width: 700px
  58. Explain command
  59. sonata:admin:setup-acl
  60. ----------------------
  61. The ``sonata:admin:setup-acl`` command updates ACL definitions for all Admin
  62. classes available in ``sonata.admin.pool``. For instance, every time you create a
  63. new ``Admin`` class, you can create its ACL by using the ``sonata:admin:setup-acl``
  64. command. The ACL database will be automatically updated with the latest masks
  65. and roles.
  66. Usage example:
  67. .. code-block:: bash
  68. php app/console sonata:admin:setup-acl