Explorar el Código

reorganize the documentation

Thomas Rabaix hace 13 años
padre
commit
bb82bb9b39

+ 12 - 0
README.md

@@ -0,0 +1,12 @@
+Doctrine ORM Admin
+==================
+
+This bundle integrates the SonataAdminBundle with the Doctrine ORM project.
+
+The online documentation of the bundle is in http://sonata-project.org/bundles/doctrine-orm-admin
+
+For contribution to the documentation you cand find it on ``Resources/doc``.
+
+**Warning**: documentation files are not rendering correctly in Github (reStructuredText format)
+and some content might be broken or hidden, make sure to read raw files.
+

+ 5 - 23
Resources/doc/index.rst

@@ -3,10 +3,10 @@
    You can adapt this file completely to your liking, but it should at least
    contain the root `toctree` directive.
 
-Welcome to Sonata - AdminBundle's documentation!
-================================================
+Welcome to Sonata - Doctrine ORM Admin's documentation!
+=======================================================
 
-The ``AdminBundle`` provides a CRUD interface for model entities.
+The ``Doctrine ORM Admin`` provides services to work with the ``Admin Bundle`` and the ``Doctrine Project``.
 
 Reference Guide
 ---------------
@@ -16,31 +16,13 @@ Reference Guide
    :numbered:
 
    reference/installation
-   reference/architecture
    reference/list_field_definition
    reference/filter_field_definition
    reference/form_field_definition
    reference/form_types_and_transformers
    reference/templates
-   reference/saving_hooks
-   reference/routing
-   reference/dashboard
-   reference/security
-   reference/conditional_validation
-   reference/update
-   reference/advance
-
-
-Doctrine ORM
-------------
-
-.. toctree::
-   :maxdepth: 1
-   :numbered:
-
-   doctrine_orm/query_proxy
-   doctrine_orm/troubleshootings
-
+   reference/query_proxy
+   reference/troubleshootings
 
 Tutorial
 --------

+ 0 - 31
Resources/doc/reference/advance.rst

@@ -1,31 +0,0 @@
-Advance
-=======
-
-By default services who are injected to an admin instance are
-
-========================    =============================================
-    method name             Service Id
-========================    =============================================
-    model_manager           sonata.admin.manager.%manager-type%
-    form_contractor         sonata.admin.builder.%manager-type%_form
-    show_builder            sonata.admin.builder.%manager-type%_show
-    list_builder            sonata.admin.builder.%manager-type%_list
-    datagrid_builder        sonata.admin.builder.%manager-type%_datagrid
-    translator              translator
-    configuration_pool      sonata.admin.pool
-    router                  router
-    validator               validator
-    security_handler        sonata.admin.security.handler
-
-Note: %manager-type% is replace by the manager type (orm, odm...)
-
-If you want to modify the service who are going to be injected, add the following code to your
-application's config file:
-
-.. code-block:: yaml
-
-    # app/config/config.yml
-    admins:
-        sonata_admin: #method name, you can find the list in the table above
-            sonata.order.admin.order: #id of the admin service's
-                model_manager: sonata.order.admin.order.manager #id of the your service

+ 0 - 141
Resources/doc/reference/architecture.rst

@@ -1,141 +0,0 @@
-Architecture
-============
-
-The architecture of the bundle is primarily inspired by the Django Admin
-Project, which is truly a great project. More information can be found at the
-`Django Project Website`_.
-
-The Admin Class
----------------
-
-The ``Admin`` class represents the CRUD definition for a specific model. It
-contains all the configuration necessary to display a rich CRUD interface for
-the entity.
-
-Within the admin class, the following information can be defined:
-
-* ``list``: The fields displayed in the list table;
-* ``filter``: The fields available for filtering the list;
-* ``form``: The fields used to edit the entity;
-* ``show``: The fields used to show the entity;
-* Batch actions: Actions that can be performed on a group of entities
-  (e.g. bulk delete)
-
-If a field is associated with another entity (and that entity also has an
-``Admin`` class), then the related ``Admin`` class will be accessible from
-within the first class.
-
-The admin class is a service implementing the ``AdminInterface`` interface,
-meaning that the following required dependencies are automatically injected:
-
-* ``ListBuilder``: builds the list fields
-* ``FormContractor``: constructs the form using the Symfony ``FormBuilder``
-* ``DatagridBuilder``: builds the filter fields
-* ``Router``: generates the different urls
-* ``Request``
-* ``ModelManager``: Service which handles specific ORM code
-* ``Translator``
-
-Therefore, you can gain access to any service you want by injecting them into
-the admin class, like so:
-
-.. code-block:: xml
-
-    <service id="sonata.news.admin.post" class="%sonata.news.admin.post.class%">
-        <tag name="sonata.admin" manager_type="orm" group="sonata_blog" label="post"/>
-        <argument />
-        <argument>%sonata.news.admin.post.entity%</argument>
-        <argument>%sonata.news.admin.post.controller%</argument>
-
-        <call method="setUserManager">
-            <argument type="service" id="fos_user.user_manager" />
-        </call>
-
-    </service>
-
-Here, the FOS' User Manager is injected into the Post service.
-
-Field Definition
-----------------
-
-A field definition is a ``FieldDescription`` object. There is one definition per list
-field.
-
-The definition contains:
-
-* ``name``: The name of the field definition;
-* ``type``: The field type;
-* ``template``: The template to use to display the field;
-* ``targetEntity``: The class name of the target entity for relations;
-* ``options``: Certain field types have additional options;
-
-Template Configuration
------------------------
-
-The current implementation uses Twig as the template engine. All templates
-are located in the ``Resources/views/CRUD`` directory of the bundle. The base
-template extends two layouts:
-
-* ``AdminBundle::standard_layout.twig``
-* ``AdminBundle::ajax_layout.twig``
-
-The base templates can be configured in the Service Container. So you can easily tweak
-the layout to suit your requirements.
-
-Each field is rendered in three different ways and each has its own Twig
-template. For example, for a field with a ``text`` type, the following three
-templates will be used:
-
-* ``filter_text.twig``: template used in the filter box
-* ``list_text.twig``: template used in the list table
-
-CrudController
---------------
-
-The controller contains the basic CRUD actions, it controller is related to one
-``Admin`` class by mapping the controller name to the correct ``Admin``
-instance.
-
-Any or all actions can be overwritten to suit the project's requirements.
-
-The controller uses the ``Admin`` class to construct the different actions.
-Inside the controller, the ``Admin`` object is accessible through the
-``configuration`` property.
-
-Obtaining an ``Admin`` Service
-------------------------------
-
-``Admin`` definitions are accessible through the 'sonata.admin.pool' service or
-directly from the DIC. The ``Admin`` definitions are lazy loaded from the DIC to
-reduce overhead.
-
-Declaring a new Admin class
----------------------------
-
-Once you have created an admin class, you must declare the class to use it. Like
-
-.. code-block:: xml
-
-    <!-- app/config/config.xml -->
-    <service id="sonata.news.admin.post" class="Sonata\NewsBundle\Admin\PostAdmin">
-
-        <tag name="sonata.admin" manager_type="orm" group="sonata_blog" label="post"/>
-
-        <argument />
-        <argument>Sonata\NewsBundle\Entity\Post</argument>
-        <argument>SonataNewsBundle:PostAdmin</argument>
-    </service>
-
-Or if you're using a YML configuration file,
-
-.. code-block:: yaml
-
-    services:
-       sonata.news.admin.post:
-          class: Sonata\NewsBundle\Admin\PostAdmin
-          tags:
-            - { name: sonata.admin, manager_type: orm, group: sonata_blog, label: post }
-          arguments: [null, Sonata\NewsBundle\Entity\Post, SonataNewsBundle:PostAdmin]
-
-
-.. _`Django Project Website`: http://www.djangoproject.com/

+ 0 - 100
Resources/doc/reference/conditional_validation.rst

@@ -1,100 +0,0 @@
-Inline Validation
-=================
-
-The inline validation is about delegating model validation to a dedicated service.
-The current validation implementation built in the Symfony2 framework is very powerful
-as it allows to declare validation on : class, field and getter. However these declaration
-can take a while to code for complexe rules. As a rules must be a set of a ``Constraint``
-and ``Validator`` instance.
-
-The inline validation try to provide a nice solution by introducting a ``ErrorElement``
-object. The object can be use to check assertion against a model :
-
-.. code-block:: php
-
-    <?php
-    $errorElement
-        ->with('settings.url')
-            ->assertNotNull(array())
-            ->assertNotBlank()
-        ->end()
-        ->with('settings.title')
-            ->assertNotNull(array())
-            ->assertNotBlank()
-            ->assertMinLength(array('limit' => 50))
-            ->addViolation('ho yeah!')
-        ->end();
-
-    if (/* complex rules */) {
-        $errorElement->with('value')->addViolation('Fail to check the complex rules')->end()
-    }
-
-    /* conditional validation */
-    if ($this->getSubject()->getState() == Post::STATUS_ONLINE) {
-        $errorElement
-            ->with('enabled')
-                ->assertNotNull()
-                ->assertTrue()
-            ->end();
-    }
-
-.. note::
-
-    This solution rely on the validator component so validation defined through
-    the validator component will be used.
-
-Using this validator
---------------------
-
-Just add the ``InlineConstraint`` class constraint, like this:
-
-.. code-block:: xml
-
-    <class name="Application\Sonata\PageBundle\Entity\Block">
-        <constraint name="Sonata\AdminBundle\Validator\Constraints\InlineConstraint">
-            <option name="service">sonata.page.cms.page</option>
-            <option name="method">validateBlock</option>
-        </constraint>
-    </class>
-
-There are two important options:
-
-  - ``service``: the service where the validation method is defined
-  - ``method``: the service's method to call
-
-The method must accept two arguments:
-
- - ``ErrorElement``: the instance where assertion can be check
- - ``value``: the object instance
-
-
-Sample with the ``PageBundle``
-------------------------------
-
-.. code-block:: php
-
-    <?php
-    namespace Sonata\PageBundle\Block;
-
-    use Sonata\PageBundle\Model\PageInterface;
-    use Sonata\AdminBundle\Validator\ErrorElement;
-
-    class RssBlockService extends BaseBlockService
-    {
-        // ... code removed for simplification
-
-        public function validateBlock(ErrorElement $errorElement, BlockInterface $block)
-        {
-            $errorElement
-                ->with('settings.url')
-                    ->assertNotNull(array())
-                    ->assertNotBlank()
-                ->end()
-                ->with('settings.title')
-                    ->assertNotNull(array())
-                    ->assertNotBlank()
-                    ->assertMinLength(array('limit' => 50))
-                    ->addViolation('ho yeah!')
-                ->end();
-        }
-    }

+ 0 - 73
Resources/doc/reference/dashboard.rst

@@ -1,73 +0,0 @@
-Dashboard
-=========
-
-The dashboard is the main landing page. By default the dashboard lists the
-different admin areas available.
-If you want to custom the dashboard, add the following code to your
-application's config file:
-
-.. code-block:: yaml
-
-    # app/config/config.yml
-    sonata_admin:
-        dashboard_groups:
-    ... your config ...
-
-
-Examples
---------
-
-Set the label group & add all the default items
-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-.. code-block:: yaml
-
-    # app/config/config.yml
-    sonata_admin:
-        dashboard_groups:
-            sonata_page:
-                label: Page
-                items: ~
-
-Set items group
-^^^^^^^^^^^^^^^
-
-.. code-block:: yaml
-
-    # app/config/config.yml
-    sonata_admin:
-        dashboard_groups:
-            sonata_page:
-                items:
-                    - sonata.page.admin.page
-
-Add a group with all the default items
-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-.. code-block:: yaml
-
-    # app/config/config.yml
-    sonata_admin:
-        dashboard_groups:
-            sonata_page: ~
-
-Add some items in a group
-^^^^^^^^^^^^^^^^^^^^^^^^^
-
-.. code-block:: yaml
-
-    # app/config/config.yml
-    sonata_admin:
-        dashboard_groups:
-            sonata_page:
-                item_adds:
-                    - sonata.page.admin.myitem1
-                    - sonata.page.admin.myitem2
-
-
-
-
-
-.. image:: ../images/dashboard.png
-           :alt: Dashboard
-           :width: 200

+ 8 - 63
Resources/doc/reference/installation.rst

@@ -1,31 +1,16 @@
 Installation
 ============
 
-Download bundles
-----------------
+First install the Sonata Admin Bundle
 
-To begin, add the dependent bundles to the ``vendor/bundles`` directory. Add
-the following lines to the file ``deps``::
+Download bundle
+---------------
 
-  [SonatajQueryBundle]
-      git=http://github.com/sonata-project/SonatajQueryBundle.git
-      target=/bundles/Sonata/jQueryBundle
+Add the following lines to the file ``deps``::
 
-  [SonataUserBundle]
-      git=http://github.com/sonata-project/SonataUserBundle.git
-      target=/bundles/Sonata/UserBundle
-
-  [SonataAdminBundle]
-      git=http://github.com/sonata-project/SonataAdminBundle.git
-      target=/bundles/Sonata/AdminBundle
-
-  [MenuBundle]
-      git=http://github.com/knplabs/KnpMenuBundle.git
-      target=/bundles/Knp/Bundle/MenuBundle
-
-  [KnpMenu]
-      git=https://github.com/knplabs/KnpMenu.git
-      target=/knp/menu
+  [SonataDoctrineORMAdminBundle]
+      git=http://github.com/sonata-project/SonataDoctrineORMAdminBundle.git
+      target=/bundles/Sonata/DoctrineORMAdminBundle
 
 and run::
 
@@ -40,53 +25,13 @@ files:
 .. code-block:: php
 
   <?php
-  // app/autoload.php
-  $loader->registerNamespaces(array(
-      // ...
-      'Sonata'                         => __DIR__.'/../vendor/bundles',
-      'Knp'                             => array(
-          __DIR__.'/../vendor/bundles',
-          __DIR__.'/../vendor/knp/menu/src',
-      ),
-      // ...
-  ));
-
   // app/AppKernel.php
   public function registerBundles()
   {
       return array(
           // ...
-          new Sonata\jQueryBundle\SonatajQueryBundle(),
-          new Sonata\AdminBundle\SonataAdminBundle(),
-          new Knp\Bundle\MenuBundle\KnpMenuBundle(),
+          new Sonata\AdminBundle\SonataDoctrineORMAdminBundle(),
           // ...
       );
   }
 
-The bundle also contains several routes. Import them by adding the following
-code to your application's routing file:
-
-.. 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
-
-Now, install the assets from the different bundles:
-``php app/console assets:install web --symlink``.
-At this point you can access to the dashboard with the url:
-``http://yoursite.local/admin/dashboard``.
-
-.. note::
-
-    If you're using XML or PHP to specify your application's configuration,
-    the above configuration and routing will actually be placed in those
-    files, with the correct format (i.e. XML or PHP).
-
-The last important step is security, please refer to the dedicated section.

Resources/doc/doctrine_orm/query_proxy.rst → Resources/doc/reference/query_proxy.rst


+ 0 - 92
Resources/doc/reference/routing.rst

@@ -1,92 +0,0 @@
-Routing
-=======
-
-The default routes used in the CRUD controller are accessible through the
-``Admin`` class.
-
-The ``Admin`` class contains two routing methods:
-
-* ``getRoutes()``: 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 $baseRouteName = 'news_post_admin';
-    }
-
-If no ``baseRouteName`` is defined then the Admin will pick one for you, built
-in the following format: 'admin_vendor_bundlename_entityname_action'. If the
-Admin fails to find the best baseRouteName then a ``RuntimeException`` will
-be thrown.
-
-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
-
-    <a href="{{ admin.generateUrl('list') }}">List</a>
-
-    <a href="{{ admin.generateUrl('list', params|merge('page': 1) }}">List</a>
-
-Create a route
---------------
-
-You can easily register new routes by defining them in the ``Admin`` class.
-Only Admin routes should be registered this way. Of course this requires the
-related action to be defined in the controller.
-
-As route is always generated with the ``Admin`` context, it can only be
-defined by its name.
-
-.. code-block:: php
-
-    use Sonata\AdminBundle\Route\RouteCollection;
-
-    class MediaAdmin extends Admin
-    {
-        protected function configureRoutes(RouteCollection $collection)
-        {
-            $collection->add('duplicate');
-            $collection->add('view', $this->getRouterIdParameter().'/view');
-        }
-    }
-
-
-Persistent parameters
----------------------
-
-In some cases, the interface might required to pass the same parameters across the different ``Admin``'s actions.
-Instead of settings them in the template or doing other weird hacks, you can defined a ``getPersistentParameters``
-method. This method will be used when a link is being generated.
-
-.. code-block:: php
-
-    class MediaAdmin extends Admin
-    {
-        public function getPersistentParameters()
-        {
-            if (!$this->getRequest()) {
-                return array();
-            }
-
-            return array(
-                'provider' => $this->getRequest()->get('provider'),
-                'context'  => $this->getRequest()->get('context', 'default'),
-            );
-        }
-    }
-
-    // the result :
-    //   $admin->generateUrl('create') => /admin/module/create?context=default

+ 0 - 85
Resources/doc/reference/saving_hooks.rst

@@ -1,85 +0,0 @@
-Saving hooks
-============
-
-When the model is persited upon on the object stated two Admin methods are always call. You can extends this
-method to add custom business logic.
-
-    - new object : ``prePersist($object)`` / ``postPersist($object)``
-    - new object : ``preUpdate($object)`` / ``postUpdate($object)``
-    - deleted object : ``preRemove($object)`` / ``postRemove($object)``
-
-
-Example used with the FOS/UserBundle
-------------------------------------
-
-The ``FOSUserBundle`` provides authentication features for your Symfony2 Project. Compatible with Doctrine ORM & ODM.
-See https://github.com/FriendsOfSymfony/UserBundle for more information.
-
-The user management system requires to perform specific call when the user password or username are updated. This
-is how the Admin bundle can be used to solve the issue by using the ``prePersist`` saving hook.
-
-.. code-block:: php
-
-    <?php
-    namespace FOS\UserBundle\Admin\Entity;
-
-    use Sonata\AdminBundle\Admin\Admin;
-    use FOS\UserBundle\Model\UserManagerInterface;
-
-    class UserAdmin extends Admin
-    {
-        protected function configureFormFields(FormMapper $formMapper)
-        {
-            $formMapper
-                ->with('General')
-                    ->add('username')
-                    ->add('email')
-                    ->add('plainPassword', 'text')
-                ->end()
-                ->with('Groups')
-                    ->add('groups', 'sonata_type_model', array('required' => false))
-                ->end()
-                ->with('Management')
-                    ->add('roles', 'sonata_security_roles', array( 'multiple' => true))
-                    ->add('locked', null, array('required' => false))
-                    ->add('expired', null, array('required' => false))
-                    ->add('enabled', null, array('required' => false))
-                    ->add('credentialsExpired', null, array('required' => false))
-                ->end()
-            ;
-        }
-        public function preUpdate($user)
-        {
-            $this->getUserManager()->updateCanonicalFields($user);
-            $this->getUserManager()->updatePassword($user);
-        }
-
-        public function setUserManager(UserManagerInterface $userManager)
-        {
-            $this->userManager = $userManager;
-        }
-
-        /**
-         * @return UserManagerInterface
-         */
-        public function getUserManager()
-        {
-            return $this->userManager;
-        }
-    }
-
-
-The service declaration where the ``UserManager`` is injected into the Admin class.
-
-.. code-block:: xml
-
-    <service id="fos.user.admin.user" class="%fos.user.admin.user.class%">
-        <tag name="sonata.admin" manager_type="orm" group="fos_user" />
-        <argument />
-        <argument>%fos.user.admin.user.entity%</argument>
-        <argument />
-
-        <call method="setUserManager">
-            <argument type='service' id='fos_user.user_manager' />
-        </call>
-    </service>

+ 0 - 141
Resources/doc/reference/security.rst

@@ -1,141 +0,0 @@
-Security
-========
-
-The security part is managed by a ``SecurityHandler``, the bundle comes with 2 handlers
-
-  - ``sonata.admin.security.handler.acl`` : ACL and ROLES to handle permissions
-  - ``sonata.admin.security.handler.noop`` : always return true, can be used with the Symfony2 firewall
-
-The default value is ``sonata.admin.security.handler.noop``, if you want to change the default value
-you can set the ``security_handler`` to ``sonata.admin.security.handler.acl``.
-
-.. code-block:: yaml
-
-    sonata_admin:
-        security_handler: sonata.admin.security.handler.acl
-
-The following section explains how to set up ACL with the ``FriendsOfSymfony/UserBundle``.
-
-ACL and FriendsOfSymfony/UserBundle
------------------------------------
-
-If you want an easy way to handle users, please use :
-
- - https://github.com/FriendsOfSymfony/FOSUserBundle : handle users and group stored from RDMS or MongoDB
- - https://github.com/sonata-project/SonataUserBundle : integrate the ``FriendsOfSymfony/UserBundle`` with
-   the ``AdminBundle``
-
-The security integration is a work in progress and have some knows issues :
- - ACL permissions are immutables
- - Only one PermissionMap can be defined
-
-
-Configuration
-~~~~~~~~~~~~~
-
-    - The following configuration defines :
-
-        - the ``FriendsOfSymfony/FOSUserBundle`` as a security provider
-        - the login form for authentification
-        - the access control : resources with related required roles, the important part is the admin configuration
-        - the ``acl`` option enable the ACL.
-
-.. code-block:: yaml
-
-    parameters:
-        # ... other parameters
-        security.acl.permission.map.class: Sonata\AdminBundle\Security\Acl\Permission\AdminPermissionMap
-
-    security:
-        providers:
-            fos_userbundle:
-                id: fos_user.user_manager
-
-        firewalls:
-            main:
-                pattern:      .*
-                form-login:
-                    provider:       fos_userbundle
-                    login_path:     /login
-                    use_forward:    false
-                    check_path:     /login_check
-                    failure_path:   null
-                logout:       true
-                anonymous:    true
-
-        access_control:
-            # The WDT has to be allowed to anonymous users to avoid requiring the login with the AJAX request
-            - { path: ^/wdt/, role: IS_AUTHENTICATED_ANONYMOUSLY }
-            - { path: ^/profiler/, role: IS_AUTHENTICATED_ANONYMOUSLY }
-
-            # AsseticBundle paths used when using the controller for assets
-            - { path: ^/js/, role: IS_AUTHENTICATED_ANONYMOUSLY }
-            - { path: ^/css/, role: IS_AUTHENTICATED_ANONYMOUSLY }
-
-            # URL of FOSUserBundle which need to be available to anonymous users
-            - { path: ^/login$, role: IS_AUTHENTICATED_ANONYMOUSLY }
-            - { path: ^/login_check$, role: IS_AUTHENTICATED_ANONYMOUSLY } # for the case of a failed login
-            - { path: ^/user/new$, role: IS_AUTHENTICATED_ANONYMOUSLY }
-            - { path: ^/user/check-confirmation-email$, role: IS_AUTHENTICATED_ANONYMOUSLY }
-            - { path: ^/user/confirm/, role: IS_AUTHENTICATED_ANONYMOUSLY }
-            - { path: ^/user/confirmed$, role: IS_AUTHENTICATED_ANONYMOUSLY }
-            - { path: ^/user/request-reset-password$, role: IS_AUTHENTICATED_ANONYMOUSLY }
-            - { path: ^/user/send-resetting-email$, role: IS_AUTHENTICATED_ANONYMOUSLY }
-            - { path: ^/user/check-resetting-email$, role: IS_AUTHENTICATED_ANONYMOUSLY }
-            - { path: ^/user/reset-password/, role: IS_AUTHENTICATED_ANONYMOUSLY }
-
-            # Secured part of the site
-            # This config requires being logged for the whole site and having the admin role for the admin part.
-            # Change these rules to adapt them to your needs
-            - { path: ^/admin/, role: ROLE_ADMIN }
-            - { path: ^/.*, role: IS_AUTHENTICATED_ANONYMOUSLY }
-
-
-        role_hierarchy:
-            ROLE_ADMIN:       ROLE_USER
-            ROLE_SUPER_ADMIN: [ROLE_ADMIN, ROLE_SONATA_ADMIN, ROLE_ALLOWED_TO_SWITCH]
-
-        acl:
-            connection: default
-
-- Install the ACL tables ``php app/console init:acl``
-
-- Create a new user :
-
-.. code-block::
-
-    # php app/console fos:user:create
-    Please choose a username:root
-    Please choose an email:root@domain.com
-    Please choose a password:root
-    Created user root
-
-
-- Promote an user as super admin :
-
-.. code-block::
-
-    # php app/console fos:user:promote root
-    User "root" has been promoted as a super administrator.
-
-If you have Admin classes, you can install the related CRUD ACL rules :
-
-.. code-block::
-
-    # php app/console sonata:admin:setup-acl
-    Starting ACL AdminBundle configuration
-    > install ACL for sonata.media.admin.media
-       - add role: ROLE_SONATA_MEDIA_ADMIN_MEDIA_EDIT, ACL: ["EDIT"]
-       - add role: ROLE_SONATA_MEDIA_ADMIN_MEDIA_LIST, ACL: ["LIST"]
-       - add role: ROLE_SONATA_MEDIA_ADMIN_MEDIA_CREATE, ACL: ["CREATE"]
-       - add role: ROLE_SONATA_MEDIA_ADMIN_MEDIA_DELETE, ACL: ["DELETE"]
-       - add role: ROLE_SONATA_MEDIA_ADMIN_MEDIA_OPERATOR, ACL: ["OPERATOR"]
-    ... skipped ...
-
-If you try to access to the admin class you should see the login form, just logon with the ``root`` user.
-
-Usage
-~~~~~
-
-Everytime you create a new ``Admin`` class, you should create start the command ``php app/console sonata:admin:setup-acl``
-so the ACL database will be updated with the latest masks and roles informations.

+ 7 - 8
Resources/doc/reference/templates.rst

@@ -1,7 +1,7 @@
 Templates
 =========
 
-By default, an Admin class used a set of templates, it is possible to tweak the default values by editing the configuration
+You can customize the global layout by tweaking the ``SonataAdminBundle`` configuration.
 
 .. code-block:: yaml
 
@@ -17,12 +17,11 @@ By default, an Admin class used a set of templates, it is possible to tweak the
             edit:    SonataAdminBundle:CRUD:edit.html.twig
 
 
-Usage of each template :
+You can also configure the templates used by the Form Framework while rendering the widget
 
-* layout : based layout used by the dashboard and an admin class
-* ajax : default layout used when an ajax request is performed
-* list : the template to use for the list action
-* show : the template to use for the show action
-* edit : the template to use for the edit and create action
+.. code-block:: yaml
 
-The default values will be set only if the ``Admin::setTemplates`` is not called by the Container.
+    sonata_doctrine_orm_admin:
+        templates:
+            form: [ SonataDoctrineORMAdminBundle:Form:form_admin_fields.html.twig ]
+            filter: [ SonataDoctrineORMAdminBundle:Form:filter_admin_fields.html.twig ]

Resources/doc/doctrine_orm/troubleshootings.rst → Resources/doc/reference/troubleshootings.rst


+ 0 - 102
Resources/doc/reference/update.rst

@@ -1,102 +0,0 @@
-Update notes for early users
-============================
-
-* Property definitions has been removed
-* ``[Form|List|Datagrid|Show]Mapper::add`` signature has been updated
-* ``FormMapper::addType`` does not exists anymore
-* ListMapper now have an ``addIdentifier`` method
-* internal Sonata Form Types must be set as second argument of the FormMapper
-
-.. code-block:: php
-
-    <?php
-    namespace Sonata\NewsBundle\Admin;
-
-    use Sonata\AdminBundle\Admin\Admin;
-    use Sonata\AdminBundle\Form\FormMapper;
-    use Sonata\AdminBundle\Datagrid\DatagridMapper;
-    use Sonata\AdminBundle\Datagrid\ListMapper;
-    use Sonata\AdminBundle\Show\ShowMapper;
-
-    use Knp\Menu\ItemInterface as MenuItemInterface;
-
-    use Application\Sonata\NewsBundle\Entity\Comment;
-
-    class PostAdmin extends Admin
-    {
-        protected $userManager;
-
-        protected function configureShowField(ShowMapper $showMapper)
-        {
-            $showMapper
-                ->add('author')
-                ->add('enabled')
-                ->add('title')
-                ->add('abstract')
-                ->add('content')
-                ->add('tags')
-            ;
-        }
-
-        protected function configureFormFields(FormMapper $formMapper)
-        {
-            $formMapper
-                ->with('General')
-                    ->add('enabled', null, array('required' => false))
-                    ->add('author', 'sonata_type_model', array(), array('edit' => 'list'))
-                    ->add('title')
-                    ->add('abstract')
-                    ->add('content')
-                ->end()
-                ->with('Tags')
-                    ->add('tags', 'sonata_type_model', array('expanded' => true))
-                ->end()
-                ->with('Options', array('collapsed' => true))
-                    ->add('commentsCloseAt')
-                    ->add('commentsEnabled', null, array('required' => false))
-                    ->add('commentsDefaultStatus', 'choice', array('choices' => Comment::getStatusList()))
-                ->end()
-            ;
-        }
-
-        protected function configureListFields(ListMapper $listMapper)
-        {
-            $listMapper
-                ->addIdentifier('title')
-                ->add('author')
-                ->add('enabled')
-                ->add('tags')
-                ->add('commentsEnabled')
-            ;
-        }
-
-        protected function configureDatagridFilters(DatagridMapper $datagridMapper)
-        {
-            $datagridMapper
-                ->add('title')
-                ->add('enabled')
-                ->add('tags', 'orm_many_to_many', array('filter_field_options' => array('expanded' => true, 'multiple' => true)))
-                ->add('with_open_comments', 'callback', array(
-                    'template' => 'SonataAdminBundle:CRUD:filter_callback.html.twig',
-                    'filter_options' => array(
-                        'filter' => array($this, 'getWithOpenCommentFilter'),
-                        'type'   => 'checkbox'
-                    ),
-                    'filter_field_options' => array(
-                        'required' => false
-                    )
-                ))
-            ;
-        }
-
-        public function getWithOpenCommentFilter($queryBuilder, $alias, $field, $value)
-        {
-            if (!$value) {
-                return;
-            }
-
-            $queryBuilder->leftJoin(sprintf('%s.comments', $alias), 'c');
-            $queryBuilder->andWhere('c.status = :status');
-            $queryBuilder->setParameter('status', Comment::STATUS_MODERATE);
-        }
-    }