Routing
=======
The default routes used in the CRUD controller are accessible through the
``Admin`` class.
The ``Admin`` class contains two routing method:
* ``getUrls()``: Returns the available routes;
* ``generateUrl($name, $options)``: Generates the related routes.
Routing Definition
------------------
You can set a ``baseRouteName`` property inside your ``Admin`` class, which
represents the route prefix.
.. code-block:: php
class PostAdmin extends Admin
{
protected $class = 'Application\Sonata\NewsBundle\Entity\Post';
protected $baseRouteName = 'news_post_admin';
}
If no ``baseRouteName`` is defined then the Admin will pick on for you, built on
following format : 'admin_vendor_bundlename_entityname_action'. If the Admin
fails to find the best baseRouteName then a ``RuntimeException`` will
be throw.
The same goes for the ``baseRoutePattern``.
Routing usage
-------------
Inside a CRUD template, a route can be generated by using the ``Admin`` class.
.. code-block:: html
List
List