Skip to content

Commit

Permalink
Moved route config to installation docs
Browse files Browse the repository at this point in the history
  • Loading branch information
core23 committed Aug 23, 2017
1 parent c0a6ea9 commit cd6745c
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 43 deletions.
39 changes: 38 additions & 1 deletion Resources/doc/getting_started/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,44 @@ The translator service is required by SonataAdmin to display all labels properly
framework:
translator: { fallbacks: [en] }
Step 6: Preparing your Environment
Step 6: Define routes
---------------------

To be able to access SonataAdminBundle's pages, you need to add its routes
to your application's routing file:

.. configuration-block::

.. code-block:: yaml
# app/config/routing.yml
admin:
resource: '@SonataAdminBundle/Resources/config/routing/sonata_admin.xml'
prefix: /admin
_sonata_admin:
resource: .
type: sonata_admin
prefix: /admin
.. note::

If you're using XML or PHP to specify your application's configuration,
the above routing configuration must be placed in routing.xml or
routing.php according to your format (i.e. XML or PHP).

.. note::

For those curious about the ``resource: .`` setting: it is unusual syntax but used
because Symfony requires a resource to be defined (which points to a real file).
Once this validation passes Sonata's ``AdminPoolLoader`` is in charge of processing
this route and it simply ignores the resource setting.

At this point you can already access the (empty) admin dashboard by visiting the URL:
``http://yoursite.local/admin/dashboard``.

Step 7: Preparing your Environment
----------------------------------

As with all bundles you install, it's a good practice to clear the cache and
Expand Down
45 changes: 3 additions & 42 deletions Resources/doc/reference/getting_started.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,48 +6,9 @@ but inaccessible. You first need to configure it for your models before you can
start using it. Here is a quick checklist of what is needed to quickly setup
SonataAdminBundle and create your first admin interface for the models of your application:

* Step 1: Define SonataAdminBundle routes
* Step 2: Create an Admin class
* Step 3: Create an Admin service
* Step 4: Configuration

Define SonataAdminBundle routes
-------------------------------

To be able to access SonataAdminBundle's pages, you need to add its routes
to your application's routing file:

.. configuration-block::

.. code-block:: yaml
# app/config/routing.yml
admin:
resource: '@SonataAdminBundle/Resources/config/routing/sonata_admin.xml'
prefix: /admin
_sonata_admin:
resource: .
type: sonata_admin
prefix: /admin
.. note::

If you're using XML or PHP to specify your application's configuration,
the above routing configuration must be placed in routing.xml or
routing.php according to your format (i.e. XML or PHP).

.. note::

For those curious about the ``resource: .`` setting: it is unusual syntax but used
because Symfony requires a resource to be defined (which points to a real file).
Once this validation passes Sonata's ``AdminPoolLoader`` is in charge of processing
this route and it simply ignores the resource setting.

At this point you can already access the (empty) admin dashboard by visiting the URL:
``http://yoursite.local/admin/dashboard``.

* Step 1: Create an Admin class
* Step 2: Create an Admin service
* Step 3: Configuration

Create an Admin class
---------------------
Expand Down

0 comments on commit cd6745c

Please sign in to comment.