<commit_before>Console/Command-Line Commands
=============================

SonataAdminBundle provides the following console commands:

* ``cache:create-cache-class``
* ``sonata:admin:generate``
* ``sonata:admin:list``
* ``sonata:admin:explain``
* ``sonata:admin:setup-acl``
* ``sonata:admin:generate-object-acl``


cache:create-cache-class
------------------------

The ``cache:create-cache-class`` command generates the cache class
(``app/cache/...env.../classes.php``) from the classes.map file.

Usage example:

.. code-block:: bash

    php app/console cache:create-cache-class


sonata:admin:generate
---------------------

The ``sonata:admin:generate`` command generates a new Admin class based on the given model
class, registers it as a service and potentially creates a new controller.
As an argument you need to specify the fully qualified model class.
All passed arguments and options are used as default values in interactive mode.
You can disable the interactive mode with ``--no-interaction`` option.

Options are:
 * ``bundle``: the bundle name (the default value is determined by the given model class, e.g. "YourNSFooBundle")
 * ``admin``: the admin class basename (by default this adds "Admin" to the model class name, e.g. "BarAdmin")
 * ``controller``: the controller class basename (by default this adds "AdminController" to the model class name, e.g. "BarAdminController")
 * ``manager``: the model manager type (by default this is the first registered model manager type, e.g. "orm")
 * ``services``: the services YAML file (the default value is "services.yml" or "admin.yml" if it already exist)
 * ``id``: the admin service ID (the default value is combination of the bundle name and admin class basename like "your_ns_foo.admin.bar")

Usage example:

.. code-block:: bash

    php app/console sonata:admin:generate YourNS\FooBundle\Entity\Bar


sonata:admin:list
-----------------

To see which admin services are available use the ``sonata:admin:list`` command.
It prints all the admin service ids available in your application. This command
gets the ids from the ``sonata.admin.pool`` service where all the available admin
services are registered.

Usage example:

.. code-block:: bash

    php app/console sonata:admin:list


.. figure:: ../images/console_admin_list.png
   :align: center
   :alt: List command
   :width: 700px

   List command


sonata:admin:explain
--------------------

The ``sonata:admin:explain`` command prints details about the admin of a model.<commit_msg>sonata:admin:generate - replace backslashes with forward slashes<commit_after>Console/Command-Line Commands
=============================

SonataAdminBundle provides the following console commands:

* ``cache:create-cache-class``
* ``sonata:admin:generate``
* ``sonata:admin:list``
* ``sonata:admin:explain``
* ``sonata:admin:setup-acl``
* ``sonata:admin:generate-object-acl``


cache:create-cache-class
------------------------

The ``cache:create-cache-class`` command generates the cache class
(``app/cache/...env.../classes.php``) from the classes.map file.

Usage example:

.. code-block:: bash

    php app/console cache:create-cache-class


sonata:admin:generate
---------------------

The ``sonata:admin:generate`` command generates a new Admin class based on the given model
class, registers it as a service and potentially creates a new controller.
As an argument you need to specify the fully qualified model class.
All passed arguments and options are used as default values in interactive mode.
You can disable the interactive mode with ``--no-interaction`` option.

Options are:
 * ``bundle``: the bundle name (the default value is determined by the given model class, e.g. "YourNSFooBundle")
 * ``admin``: the admin class basename (by default this adds "Admin" to the model class name, e.g. "BarAdmin")
 * ``controller``: the controller class basename (by default this adds "AdminController" to the model class name, e.g. "BarAdminController")
 * ``manager``: the model manager type (by default this is the first registered model manager type, e.g. "orm")
 * ``services``: the services YAML file (the default value is "services.yml" or "admin.yml" if it already exist)
 * ``id``: the admin service ID (the default value is combination of the bundle name and admin class basename like "your_ns_foo.admin.bar")

Usage example:

.. code-block:: bash

    php app/console sonata:admin:generate YourNS/FooBundle/Entity/Bar


sonata:admin:list
-----------------

To see which admin services are available use the ``sonata:admin:list`` command.
It prints all the admin service ids available in your application. This command
gets the ids from the ``sonata.admin.pool`` service where all the available admin
services are registered.

Usage example:

.. code-block:: bash

    php app/console sonata:admin:list


.. figure:: ../images/console_admin_list.png
   :align: center
   :alt: List command
   :width: 700px

   List command


sonata:admin:explain
--------------------

The ``sonata:admin:explain`` command prints details about the admin of a model.
{'fraction_non_alphanumeric': 0.14488468361916026, 'fraction_numerical': 0.0011827321111768185, 'mean_word_length': 3.955078125, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4133300', 'n_tokens_mistral': 1412, 'n_tokens_neox': 1359, 'n_words': 558}