Преглед на файлове

add vendor namespace, update twig form functions

Thomas преди 14 години
родител
ревизия
3e3c791c2a
променени са 61 файла, в които са добавени 168 реда и са изтрити 140 реда
  1. 17 13
      Admin/Admin.php
  2. 3 3
      Controller/CRUDController.php
  3. 1 1
      Controller/CoreController.php
  4. 2 2
      DependencyInjection/BaseApplicationExtension.php
  5. 4 4
      Resources/config/routing/base_application.xml
  6. 0 0
      Resources/doc/images/dashboard.png
  7. 0 0
      Resources/doc/images/post_create_tag.png
  8. 0 0
      Resources/doc/images/post_create_tag_error.png
  9. 0 0
      Resources/doc/images/post_edit.png
  10. 0 0
      Resources/doc/images/post_edit_error.png
  11. 0 0
      Resources/doc/images/post_list.png
  12. 0 0
      Resources/doc/index.rst
  13. 0 0
      Resources/doc/reference/architecture.rst
  14. 0 3
      Resources/docs/reference/dashboard.rst
  15. 1 1
      Resources/docs/reference/filter_field_definition.rst
  16. 1 1
      Resources/docs/reference/form_field_definition.rst
  17. 87 0
      Resources/doc/reference/installation.rst
  18. 0 0
      Resources/doc/reference/list_field_definition.rst
  19. 0 0
      Resources/doc/reference/routing.rst
  20. 0 0
      Resources/doc/tutorial/creating_your_first_admin_class/defining_admin_class.rst
  21. 0 0
      Resources/doc/tutorial/creating_your_first_admin_class/defining_crud_controller.rst
  22. 0 0
      Resources/doc/tutorial/creating_your_first_admin_class/defining_entities.rst
  23. 0 0
      Resources/doc/tutorial/creating_your_first_admin_class/defining_routing.rst
  24. 0 0
      Resources/doc/tutorial/creating_your_first_admin_class/introduction.rst
  25. 0 55
      Resources/docs/reference/installation.rst
  26. 1 1
      Resources/views/CRUD/base_edit.twig
  27. 3 3
      Resources/views/CRUD/base_edit_field.twig
  28. 2 2
      Resources/views/CRUD/base_filter_field.twig
  29. 1 1
      Resources/views/CRUD/edit.twig
  30. 2 2
      Resources/views/CRUD/edit_array.twig
  31. 2 2
      Resources/views/CRUD/edit_boolean.twig
  32. 1 1
      Resources/views/CRUD/edit_choice.twig
  33. 1 1
      Resources/views/CRUD/edit_datetime.twig
  34. 2 2
      Resources/views/CRUD/edit_decimal.twig
  35. 2 2
      Resources/views/CRUD/edit_integer.twig
  36. 1 1
      Resources/views/CRUD/edit_many_association_script.twig
  37. 3 3
      Resources/views/CRUD/edit_many_to_many.twig
  38. 3 3
      Resources/views/CRUD/edit_many_to_one.twig
  39. 1 1
      Resources/views/CRUD/edit_one_to_one.twig
  40. 2 2
      Resources/views/CRUD/edit_string.twig
  41. 2 2
      Resources/views/CRUD/edit_text.twig
  42. 1 1
      Resources/views/CRUD/filter_boolean.twig
  43. 1 1
      Resources/views/CRUD/filter_callback.twig
  44. 1 1
      Resources/views/CRUD/filter_identifier.twig
  45. 1 1
      Resources/views/CRUD/filter_integer.twig
  46. 1 1
      Resources/views/CRUD/filter_many_to_many.twig
  47. 1 1
      Resources/views/CRUD/filter_string.twig
  48. 1 1
      Resources/views/CRUD/filter_text.twig
  49. 1 1
      Resources/views/CRUD/list.twig
  50. 1 1
      Resources/views/CRUD/list__batch.twig
  51. 1 1
      Resources/views/CRUD/list_boolean.twig
  52. 1 1
      Resources/views/CRUD/list_datetime.twig
  53. 1 1
      Resources/views/CRUD/list_decimal.twig
  54. 1 1
      Resources/views/CRUD/list_identifier.twig
  55. 1 1
      Resources/views/CRUD/list_integer.twig
  56. 1 1
      Resources/views/CRUD/list_many_to_one.twig
  57. 1 1
      Resources/views/CRUD/list_string.twig
  58. 1 1
      Resources/views/CRUD/list_text.twig
  59. 1 1
      Resources/views/Core/dashboard.twig
  60. 1 1
      Resources/views/standard_layout.twig
  61. 4 9
      Tool/Datagrid.php

+ 17 - 13
Admin/Admin.php

@@ -14,6 +14,8 @@ namespace Bundle\Sonata\BaseApplicationBundle\Admin;
 use Symfony\Component\DependencyInjection\ContainerAware;
 use Symfony\Component\Form\Form;
 
+use Bundle\Sonata\BaseApplicationBundle\Tool\Datagrid;
+
 abstract class Admin extends ContainerAware
 {
     protected $class;
@@ -128,12 +130,12 @@ abstract class Admin extends ContainerAware
 
     public function getListTemplate()
     {
-        return 'BaseApplicationBundle:CRUD:list.twig';
+        return 'Sonata\BaseApplicationBundle:CRUD:list.twig';
     }
 
     public function getEditTemplate()
     {
-        return 'BaseApplicationBundle:CRUD:edit.twig';
+        return 'Sonata\BaseApplicationBundle:CRUD:edit.twig';
     }
 
     public function getReflectionFields()
@@ -149,11 +151,13 @@ abstract class Admin extends ContainerAware
      */
     static public function getBaseFields($metadata, $selected_fields)
     {
+
         // if nothing is defined we display all fields
         if(!$selected_fields) {
             $selected_fields = array_keys($metadata->reflFields) + array_keys($metadata->associationMappings);
         }
 
+
         // make sure we works with array
         foreach($selected_fields as $name => $options) {
             if(is_array($options)) {
@@ -230,23 +234,23 @@ abstract class Admin extends ContainerAware
 
             // fix template value for doctrine association fields
             if(!isset($this->form_fields[$name]['template']) && isset($this->form_fields[$name]['type'])) {
-                $this->form_fields[$name]['template'] = sprintf('BaseApplicationBundle:CRUD:edit_%s.twig', $this->form_fields[$name]['type']);
+                $this->form_fields[$name]['template'] = sprintf('Sonata\BaseApplicationBundle:CRUD:edit_%s.twig', $this->form_fields[$name]['type']);
 
                 if($this->form_fields[$name]['type'] == \Doctrine\ORM\Mapping\ClassMetadataInfo::ONE_TO_ONE)
                 {
-                    $this->form_fields[$name]['template'] = 'BaseApplicationBundle:CRUD:edit_one_to_one.twig';
+                    $this->form_fields[$name]['template'] = 'Sonata\BaseApplicationBundle:CRUD:edit_one_to_one.twig';
                 }
 
                 if($this->form_fields[$name]['type'] == \Doctrine\ORM\Mapping\ClassMetadataInfo::MANY_TO_ONE)
                 {
-                    $this->form_fields[$name]['template'] = 'BaseApplicationBundle:CRUD:edit_many_to_one.twig';
+                    $this->form_fields[$name]['template'] = 'Sonata\BaseApplicationBundle:CRUD:edit_many_to_one.twig';
                     $this->form_fields[$name]['configuration']  = $this->getConfigurationPool()
                         ->getConfigurationByClass($this->form_fields[$name]['targetEntity']);
                 }
 
                 if($this->form_fields[$name]['type'] == \Doctrine\ORM\Mapping\ClassMetadataInfo::MANY_TO_MANY)
                 {
-                    $this->form_fields[$name]['template'] = 'BaseApplicationBundle:CRUD:edit_many_to_many.twig';
+                    $this->form_fields[$name]['template'] = 'Sonata\BaseApplicationBundle:CRUD:edit_many_to_many.twig';
                     $this->form_fields[$name]['configuration']  = $this->getConfigurationPool()
                         ->getConfigurationByClass($this->form_fields[$name]['targetEntity']);
                 }
@@ -302,27 +306,27 @@ abstract class Admin extends ContainerAware
 
             // fix template for mapping
             if($this->list_fields[$name]['type'] == \Doctrine\ORM\Mapping\ClassMetadataInfo::MANY_TO_ONE) {
-                $this->list_fields[$name]['template']       = 'BaseApplicationBundle:CRUD:list_many_to_one.twig';
+                $this->list_fields[$name]['template']       = 'Sonata/BaseApplicationBundle:CRUD:list_many_to_one.twig';
                 $this->list_fields[$name]['configuration']  = $this->getConfigurationPool()
                     ->getConfigurationByClass($this->list_fields[$name]['targetEntity']);
             }
 
             if($this->list_fields[$name]['type'] == \Doctrine\ORM\Mapping\ClassMetadataInfo::ONE_TO_MANY) {
-                $this->list_fields[$name]['template']       = 'BaseApplicationBundle:CRUD:list_one_to_many.twig';
+                $this->list_fields[$name]['template']       = 'Sonata/BaseApplicationBundle:CRUD:list_one_to_many.twig';
             }
 
             if($this->list_fields[$name]['type'] == \Doctrine\ORM\Mapping\ClassMetadataInfo::MANY_TO_MANY) {
-                $this->list_fields[$name]['template']       = 'BaseApplicationBundle:CRUD:list_many_to_many.twig';
+                $this->list_fields[$name]['template']       = 'Sonata/BaseApplicationBundle:CRUD:list_many_to_many.twig';
             }
 
             // define the default template
             if(!isset($this->list_fields[$name]['template'])) {
-                $this->list_fields[$name]['template'] = sprintf('BaseApplicationBundle:CRUD:list_%s.twig', $this->list_fields[$name]['type']);
+                $this->list_fields[$name]['template'] = sprintf('Sonata/BaseApplicationBundle:CRUD:list_%s.twig', $this->list_fields[$name]['type']);
             }
 
             // define the default template for identifier field
             if(isset($this->list_fields[$name]['id'])) {
-                $this->list_fields[$name]['template'] = 'BaseApplicationBundle:CRUD:list_identifier.twig';
+                $this->list_fields[$name]['identifier'] = true;
             }
 
         }
@@ -330,7 +334,7 @@ abstract class Admin extends ContainerAware
         if(!isset($this->list_fields['_batch'])) {
             $this->list_fields = array('_batch' => array(
                 'code'     => '_batch',
-                'template' => 'BaseApplicationBundle:CRUD:list__batch.twig',
+                'template' => 'Sonata/BaseApplicationBundle:CRUD:list__batch.twig',
                 'label'    => 'batch',
             ) ) + $this->list_fields;
         }
@@ -354,7 +358,7 @@ abstract class Admin extends ContainerAware
     {
         if(!$this->filter_datagrid) {
 
-            $this->filter_datagrid = new \Bundle\BaseApplicationBundle\Tool\Datagrid(
+            $this->filter_datagrid = new Datagrid(
                 $this->getClass(),
                 $this->getEntityManager()
             );

+ 3 - 3
Controller/CRUDController.php

@@ -48,10 +48,10 @@ class CRUDController extends Controller
     {
 
         if($this->get('request')->isXmlHttpRequest()) {
-            return 'BaseApplicationBundle::ajax_layout.twig';
+            return 'Sonata\BaseApplicationBundle::ajax_layout.twig';
         }
 
-        return 'BaseApplicationBundle::standard_layout.twig';
+        return 'Sonata\BaseApplicationBundle::standard_layout.twig';
     }
 
     public function listAction()
@@ -168,7 +168,7 @@ class CRUDController extends Controller
             if($this->get('request')->isXmlHttpRequest()) {
                 return $this->createResponse('ok');
             }
-            
+
             // redirect to edit mode
             return $this->redirect($this->configuration->generateUrl('edit', array('id' => $object->getId())));
         }

+ 1 - 1
Controller/CoreController.php

@@ -88,7 +88,7 @@ class CoreController extends Controller
     public function dashboardAction()
     {
 
-        return $this->render('BaseApplicationBundle:Core:dashboard.twig', array(
+        return $this->render('Sonata/BaseApplicationBundle:Core:dashboard.twig', array(
             'groups' => $this->get('base_application.admin.pool')->getGroups()
         ));
     }

+ 2 - 2
DependencyInjection/BaseApplicationExtension.php

@@ -40,12 +40,12 @@ class BaseApplicationExtension extends Extension
 
         // register the twig extension
         $container
-            ->register('twig.extension.base_application', 'Bundle\BaseApplicationBundle\Twig\Extension\BaseApplicationExtension')
+            ->register('twig.extension.base_application', 'Bundle\Sonata\BaseApplicationBundle\Twig\Extension\BaseApplicationExtension')
             ->addMethodCall('setTemplating', array(new Reference('templating')))
             ->addTag('twig.extension');
 
         // registers crud action
-        $definition = new Definition('Bundle\\BaseApplicationBundle\\Admin\\Pool');
+        $definition = new Definition('Bundle\Sonata\BaseApplicationBundle\Admin\Pool');
         $definition->addMethodCall('setContainer', array(new Reference('service_container')));
         foreach($config['entities'] as $code => $configuration) {
             if(!isset($configuration['group'])) {

+ 4 - 4
Resources/config/routing/base_application.xml

@@ -4,12 +4,12 @@
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xsi:schemaLocation="http://www.symfony-project.org/schema/routing http://www.symfony-project.org/schema/routing/routing-1.0.xsd">
 
-    <route id="base_application_dashboard" pattern="/dashboard">
-        <default key="_controller">BaseApplicationBundle:Core:dashboard</default>
+    <route id="sonata_base_application_dashboard" pattern="/dashboard">
+        <default key="_controller">Sonata\BaseApplicationBundle:Core:dashboard</default>
     </route>
 
-    <route id="base_application_retrieve_form_element" pattern="/core/:code/get-form-field-element/:element_id">
-        <default key="_controller">BaseApplicationBundle:Core:retrieveFormFieldElement</default>
+    <route id="sonata_base_application_retrieve_form_element" pattern="/core/:code/get-form-field-element/:element_id">
+        <default key="_controller">Sonata\BaseApplicationBundle:Core:retrieveFormFieldElement</default>
     </route>
 
 </routes>

Resources/docs/images/dashboard.png → Resources/doc/images/dashboard.png


Resources/docs/images/post_create_tag.png → Resources/doc/images/post_create_tag.png


Resources/docs/images/post_create_tag_error.png → Resources/doc/images/post_create_tag_error.png


Resources/docs/images/post_edit.png → Resources/doc/images/post_edit.png


Resources/docs/images/post_edit_error.png → Resources/doc/images/post_edit_error.png


Resources/docs/images/post_list.png → Resources/doc/images/post_list.png


Resources/docs/index.rst → Resources/doc/index.rst


Resources/docs/reference/architecture.rst → Resources/doc/reference/architecture.rst


+ 0 - 3
Resources/docs/reference/dashboard.rst

@@ -3,6 +3,3 @@ Dashboard
 
 The dashboard is the main landing page. For now the dashboard lists the
 different admin areas available.
-
-
-

+ 1 - 1
Resources/docs/reference/filter_field_definition.rst

@@ -10,7 +10,7 @@ Example
 .. code-block:: php
 
     <?php
-    namespace Bundle\NewsBundle\Admin;
+    namespace Bundle\Sonata\NewsBundle\Admin;
 
     use Bundle\Sonata\BaseApplicationBundle\Admin\Admin;
 

+ 1 - 1
Resources/docs/reference/form_field_definition.rst

@@ -9,7 +9,7 @@ Example
 .. code-block:: php
 
     <?php
-    namespace Bundle\NewsBundle\Admin;
+    namespace Bundle\Sonta\NewsBundle\Admin;
 
     use Bundle\Sonata\BaseApplicationBundle\Admin\Admin;
 

+ 87 - 0
Resources/doc/reference/installation.rst

@@ -0,0 +1,87 @@
+Installation
+============
+
+To begin, add the dependent bundles to the ``src/Bundle`` directory. If using
+git, you can add them as submodules::
+
+  git submodule add git@github.com:sonata-project/jQueryBundle.git src/Bundle/Sonata/jQueryBundle
+  git submodule add git@github.com:sonata-project/BaseApplicationBundle.git src/Bundle/Sonata/BaseApplicationBundle
+
+Next, be sure to enable the bundles in your application kernel:
+
+.. code-block:: php
+
+  // app/AppKernel.php
+  public function registerBundles()
+  {
+      return array(
+          // ...
+          new Bundle\Sonata\jQueryBundle\SonatajQueryBundle(),
+          new Bundle\Sonata\BluePrintBundle\SonataBluePrintBundle(),
+          new Bundle\Sonata\BaseApplicationBundle\SonataBaseApplicationBundle(),
+          // ...
+      );
+  }
+
+Configuration
+-------------
+
+To use the ``BaseApplicationBundle``, add the following to your application
+configuration file.
+
+.. code-block:: yaml
+
+    # app/config/config.yml
+    base_application.config: ~
+
+The bundle also contains several routes. Import them by adding the following
+code to your application's routing file:
+
+- Add the BaseApplicationBundle's routing definition
+
+.. code-block:: yaml
+
+    # app/config/routing.yml
+    base_application:
+        resource: BaseApplicationBundle/Resources/config/routing/base_application.xml
+        prefix: /admin
+
+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).
+
+
+Declaring new Entity
+--------------------
+
+Once you have created an admin class, you must declare the class to use it. Like ::
+
+.. code-block:: yaml
+
+    # app/config/config.yml
+    base_application.config:
+        entities:
+            post:
+                label:      Post
+                group:      blog
+                class:      Bundle\Sonata\NewsBundle\Admin\PostAdmin
+                entity:     Application\NewsBundle\Entity\Post
+                controller: Bundle\Sonata\NewsBundle\Controller\PostAdminController
+
+            tag:
+                label:      Tag
+                group:      blog
+                class:      Bundle\Sonata\NewsBundle\Admin\TagAdmin
+                entity:     Application\NewsBundle\Entity\Tag
+                controller: Bundle\Sonata\NewsBundle\Controller\TagAdminController
+
+            comment:
+                label:      Comment
+                group:      blog
+                class:      Bundle\Sonata\NewsBundle\Admin\CommentAdmin
+                entity:     Application\NewsBundle\Entity\Comment
+                controller: Bundle\Sonata\NewsBundle\Controller\CommentAdminController

Resources/docs/reference/list_field_definition.rst → Resources/doc/reference/list_field_definition.rst


Resources/docs/reference/routing.rst → Resources/doc/reference/routing.rst


Resources/docs/tutorial/creating_your_first_admin_class/defining_admin_class.rst → Resources/doc/tutorial/creating_your_first_admin_class/defining_admin_class.rst


Resources/docs/tutorial/creating_your_first_admin_class/defining_crud_controller.rst → Resources/doc/tutorial/creating_your_first_admin_class/defining_crud_controller.rst


Resources/docs/tutorial/creating_your_first_admin_class/defining_entities.rst → Resources/doc/tutorial/creating_your_first_admin_class/defining_entities.rst


Resources/docs/tutorial/creating_your_first_admin_class/defining_routing.rst → Resources/doc/tutorial/creating_your_first_admin_class/defining_routing.rst


Resources/docs/tutorial/creating_your_first_admin_class/introduction.rst → Resources/doc/tutorial/creating_your_first_admin_class/introduction.rst


+ 0 - 55
Resources/docs/reference/installation.rst

@@ -1,55 +0,0 @@
-Installation
-============
-
-To begin, add the dependent bundles to the ``src/Bundle`` directory. If using
-git, you can add them as submodules::
-
-  git submodule add git@github.com:sonata-project/jQueryBundle.git src/Bundle/jQueryBundle
-  git submodule add git@github.com:sonata-project/BaseApplicationBundle.git src/Bundle/BaseApplicationBundle
-
-Next, be sure to enable the bundles in your application kernel:
-
-.. code-block:: php
-
-  // app/AppKernel.php
-  public function registerBundles()
-  {
-      return array(
-          // ...
-          new Bundle\jQueryBundle\jQueryBundle(),
-          new Bundle\BluePrintBundle\BluePrintBundle(),
-          new Bundle\BaseApplicationBundle\BaseApplicationBundle(),
-          // ...
-      );
-  }
-
-Configuration
--------------
-
-To use the ``BaseApplicationBundle``, add the following to your application
-configuration file.
-
-.. code-block:: yaml
-
-    # app/config/config.yml
-    base_application.config: ~
-
-The bundle also contains several routes. Import them by adding the following
-code to your application's routing file:
-
-- Add the BaseApplicationBundle's routing definition
-
-.. code-block:: yaml
-
-    # app/config/routing.yml
-    base_application:
-        resource: BaseApplicationBundle/Resources/config/routing/base_application.xml
-        prefix: /admin
-
-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).

+ 1 - 1
Resources/views/CRUD/base_edit.twig

@@ -34,7 +34,7 @@ file that was distributed with this source code.
 {% block form %}
     <form action="{{ configuration.generateUrl('update', {'id': object.id}) }}" method="POST">
 
-        {{ form|render_hidden }}
+        {{ form_hidden(form) }}
 
         {% for field in fields %}
             {{ field|render_form_element(form, object, {'configuration' : configuration}) }}

+ 3 - 3
Resources/views/CRUD/base_edit_field.twig

@@ -10,14 +10,14 @@ file that was distributed with this source code.
 #}
 
 <div>
-    {% block label %}{{ field_element|render_label }} <br />{% endblock %}
+    {% block label %}{{ form_label(field_element) }} <br />{% endblock %}
 
     <div class="sonata-ba-field {% if field_element.haserrors %}sonata-ba-field-error"{% endif %}">
 
-        {% block field %}{{ field_element|render }}{% endblock %}
+        {% block field %}{{ form_field(field_element) }}{% endblock %}
 
         <div class="sonata-ba-field-error-messages">
-            {% block errors %}{{ field_element|render_errors }}{% endblock %}
+            {% block errors %}{{ form_errors(field_element) }}{% endblock %}
         </div>
 
     </div>

+ 2 - 2
Resources/views/CRUD/base_filter_field.twig

@@ -10,9 +10,9 @@ file that was distributed with this source code.
 #}
 
 <div>
-    {% block label %}{{ filter.field|render_label }} <br />{% endblock %}
+    {% block label %}{{ form_label(filter.field) }} <br />{% endblock %}
 
     <div class="sonata-ba-field {% if field.field.haserrors %}sonata-ba-field-error"{% endif %}">
-        {% block field %}{{ filter.field|render }}{% endblock %}
+        {% block field %}{{ form_field(filter.field) }}{% endblock %}
     </div>
 </div>

+ 1 - 1
Resources/views/CRUD/edit.twig

@@ -9,5 +9,5 @@ file that was distributed with this source code.
 
 #}
 
-{% extends 'BaseApplicationBundle:CRUD:base_edit.twig' %}
+{% extends 'Sonata/BaseApplicationBundle:CRUD:base_edit.twig' %}
 

+ 2 - 2
Resources/views/CRUD/edit_array.twig

@@ -9,6 +9,6 @@ file that was distributed with this source code.
 
 #}
 
-{% extends 'BaseApplicationBundle:CRUD:base_edit_field.twig' %}
+{% extends 'Sonata/BaseApplicationBundle:CRUD:base_edit_field.twig' %}
 
-{% block field %}{{ field_element|render({'class' : 'title'}) }}{% endblock %}
+{% block field %}{{ form_fiel(field_element, {'class' : 'title'}) }}{% endblock %}

+ 2 - 2
Resources/views/CRUD/edit_boolean.twig

@@ -13,10 +13,10 @@ file that was distributed with this source code.
 
     <div class="sonata-ba-field {% if field_element.haserrors %}sonata-ba-field-error"{% endif %}">
 
-        {% block field %}{{ field_element|render }}{% endblock %}{% block label %}{{ field_element|render_label }} <br />{% endblock %}
+        {% block field %}{{ form_field(field_element) }}{% endblock %}{% block label %}{{ form_label(field_element) }} <br />{% endblock %}
 
         <div class="sonata-ba-field-error-messages">
-            {% block errors %}{{ field_element|render_errors }}{% endblock %}
+            {% block errors %}{{ form_errors(field_element) }}{% endblock %}
         </div>
 
     </div>

+ 1 - 1
Resources/views/CRUD/edit_choice.twig

@@ -9,4 +9,4 @@ file that was distributed with this source code.
 
 #}
 
-{% extends 'BaseApplicationBundle:CRUD:base_edit_field.twig' %}
+{% extends 'Sonata/BaseApplicationBundle:CRUD:base_edit_field.twig' %}

+ 1 - 1
Resources/views/CRUD/edit_datetime.twig

@@ -9,4 +9,4 @@ file that was distributed with this source code.
 
 #}
 
-{% extends 'BaseApplicationBundle:CRUD:base_edit_field.twig' %}
+{% extends 'Sonata/BaseApplicationBundle:CRUD:base_edit_field.twig' %}

+ 2 - 2
Resources/views/CRUD/edit_decimal.twig

@@ -9,6 +9,6 @@ file that was distributed with this source code.
 
 #}
 
-{% extends 'BaseApplicationBundle:CRUD:base_edit_field.twig' %}
+{% extends 'Sonata/BaseApplicationBundle:CRUD:base_edit_field.twig' %}
 
-{% block field %}{{ field_element|render({'class' : 'title'}) }}{% endblock %}
+{% block field %}{{ form_field(field_element, {'class' : 'title'}) }}{% endblock %}

+ 2 - 2
Resources/views/CRUD/edit_integer.twig

@@ -9,6 +9,6 @@ file that was distributed with this source code.
 
 #}
 
-{% extends 'BaseApplicationBundle:CRUD:base_edit_field.twig' %}
+{% extends 'Sonata/BaseApplicationBundle:CRUD:base_edit_field.twig' %}
 
-{% block field %}{{ field_element|render({'class' : 'title'}) }}{% endblock %}
+{% block field %}{{ form_field(field_element, {'class' : 'title'}) }}{% endblock %}

+ 1 - 1
Resources/views/CRUD/edit_many_association_script.twig

@@ -73,7 +73,7 @@ This code manage the many-to-[one|many] association field popup
 
                     // reload the form element
                     jQuery.ajax({
-                        url: '{{ url('base_application_retrieve_form_element', {
+                        url: '{{ url('sonata_base_application_retrieve_form_element', {
                             'code':         configuration.code,
                             'element_id':   field_element.id,
                             'object_id':    form.data.id,

+ 3 - 3
Resources/views/CRUD/edit_many_to_many.twig

@@ -9,12 +9,12 @@ file that was distributed with this source code.
 
 #}
 
-{% extends 'BaseApplicationBundle:CRUD:base_edit_field.twig' %}
+{% extends 'Sonata/BaseApplicationBundle:CRUD:base_edit_field.twig' %}
 
 {% block field %}
     <div id="field_container_{{ configuration.code }}_{{ field_element.id}}">
         <span id="field_widget_{{ configuration.code }}_{{ field_element.id}}" >
-            {{ field_element|render }}
+            {{ form_field(field_element) }}
         </span>
         
         <span id="field_actions_{{ configuration.code }}_{{ field_element.id}}" >
@@ -26,5 +26,5 @@ file that was distributed with this source code.
         </div>
     </div>
 
-    {% include 'BaseApplicationBundle:CRUD:edit_many_association_script.twig' %}
+    {% include 'Sonata/BaseApplicationBundle:CRUD:edit_many_association_script.twig' %}
 {% endblock %}

+ 3 - 3
Resources/views/CRUD/edit_many_to_one.twig

@@ -9,12 +9,12 @@ file that was distributed with this source code.
 
 #}
 
-{% extends 'BaseApplicationBundle:CRUD:base_edit_field.twig' %}
+{% extends 'Sonata/BaseApplicationBundle:CRUD:base_edit_field.twig' %}
 
 {% block field %}
     <div id="field_container_{{ configuration.code }}_{{ field_element.id}}">
         <span id="field_widget_{{ configuration.code }}_{{ field_element.id}}" >
-            {{ field_element|render }}
+            {{ form_field(field_element) }}
         </span>
         
         <span id="field_actions_{{ configuration.code }}_{{ field_element.id}}" >
@@ -26,5 +26,5 @@ file that was distributed with this source code.
         </div>
     </div>
 
-    {% include 'BaseApplicationBundle:CRUD:edit_many_association_script.twig' %}
+    {% include 'Sonata/BaseApplicationBundle:CRUD:edit_many_association_script.twig' %}
 {% endblock %}

+ 1 - 1
Resources/views/CRUD/edit_one_to_one.twig

@@ -9,4 +9,4 @@ file that was distributed with this source code.
 
 #}
 
-{% extends 'BaseApplicationBundle:CRUD:base_edit_field.twig' %}
+{% extends 'Sonata/BaseApplicationBundle:CRUD:base_edit_field.twig' %}

+ 2 - 2
Resources/views/CRUD/edit_string.twig

@@ -9,6 +9,6 @@ file that was distributed with this source code.
 
 #}
 
-{% extends 'BaseApplicationBundle:CRUD:base_edit_field.twig' %}
+{% extends 'Sonata/BaseApplicationBundle:CRUD:base_edit_field.twig' %}
 
-{% block field %}{{ field_element|render({'class' : 'title'}) }}{% endblock %}
+{% block field %}{{ form_field(field_element, {'class' : 'title'}) }}{% endblock %}

+ 2 - 2
Resources/views/CRUD/edit_text.twig

@@ -9,6 +9,6 @@ file that was distributed with this source code.
 
 #}
 
-{% extends 'BaseApplicationBundle:CRUD:base_edit_field.twig' %}
+{% extends 'Sonata/BaseApplicationBundle:CRUD:base_edit_field.twig' %}
 
-{% block field %}{{ field_element|render({'class' : 'title'}) }}{% endblock %}
+{% block field %}{{ form_field(field_element, {'class' : 'title'}) }}{% endblock %}

+ 1 - 1
Resources/views/CRUD/filter_boolean.twig

@@ -9,4 +9,4 @@ file that was distributed with this source code.
 
 #}
 
-{% extends 'BaseApplicationBundle:CRUD:base_filter_field.twig' %}
+{% extends 'Sonata/BaseApplicationBundle:CRUD:base_filter_field.twig' %}

+ 1 - 1
Resources/views/CRUD/filter_callback.twig

@@ -9,4 +9,4 @@ file that was distributed with this source code.
 
 #}
 
-{% extends 'BaseApplicationBundle:CRUD:base_filter_field.twig' %}
+{% extends 'Sonata/BaseApplicationBundle:CRUD:base_filter_field.twig' %}

+ 1 - 1
Resources/views/CRUD/filter_identifier.twig

@@ -9,5 +9,5 @@ file that was distributed with this source code.
 
 #}
 
-{% extends 'BaseApplicationBundle:CRUD:base_filter_field.twig' %}
+{% extends 'Sonata/BaseApplicationBundle:CRUD:base_filter_field.twig' %}
 

+ 1 - 1
Resources/views/CRUD/filter_integer.twig

@@ -9,5 +9,5 @@ file that was distributed with this source code.
 
 #}
 
-{% extends 'BaseApplicationBundle:CRUD:base_filter_field.twig' %}
+{% extends 'Sonata/BaseApplicationBundle:CRUD:base_filter_field.twig' %}
 

+ 1 - 1
Resources/views/CRUD/filter_many_to_many.twig

@@ -9,5 +9,5 @@ file that was distributed with this source code.
 
 #}
 
-{% extends 'BaseApplicationBundle:CRUD:base_filter_field.twig' %}
+{% extends 'Sonata/BaseApplicationBundle:CRUD:base_filter_field.twig' %}
 

+ 1 - 1
Resources/views/CRUD/filter_string.twig

@@ -9,5 +9,5 @@ file that was distributed with this source code.
 
 #}
 
-{% extends 'BaseApplicationBundle:CRUD:base_filter_field.twig' %}
+{% extends 'Sonata/BaseApplicationBundle:CRUD:base_filter_field.twig' %}
 

+ 1 - 1
Resources/views/CRUD/filter_text.twig

@@ -9,5 +9,5 @@ file that was distributed with this source code.
 
 #}
 
-{% extends 'BaseApplicationBundle:CRUD:base_filter_field.twig' %}
+{% extends 'Sonata/BaseApplicationBundle:CRUD:base_filter_field.twig' %}
 

+ 1 - 1
Resources/views/CRUD/list.twig

@@ -9,7 +9,7 @@ file that was distributed with this source code.
 
 #}
 
-{% extends 'BaseApplicationBundle:CRUD:base_list.twig' %}
+{% extends 'Sonata/BaseApplicationBundle:CRUD:base_list.twig' %}
 
 {% block table_body %}
     {% for element in datagrid.results %}

+ 1 - 1
Resources/views/CRUD/list__batch.twig

@@ -9,6 +9,6 @@ file that was distributed with this source code.
 
 #}
 
-{% extends 'BaseApplicationBundle:CRUD:base_list_field.twig' %}
+{% extends 'Sonata/BaseApplicationBundle:CRUD:base_list_field.twig' %}
 
 {% block field%}<input type="checkbox" name="idx[]" value="{{ object.id }}" />{% endblock %}

+ 1 - 1
Resources/views/CRUD/list_boolean.twig

@@ -9,7 +9,7 @@ file that was distributed with this source code.
 
 #}
 
-{% extends 'BaseApplicationBundle:CRUD:base_list_field.twig' %}
+{% extends 'Sonata/BaseApplicationBundle:CRUD:base_list_field.twig' %}
 
 {% block field%}<img src="/bundles/baseapplication/famfamfam/{% if value %}accept{% else %}exclamation{% endif %}.png" />{% endblock %}
 

+ 1 - 1
Resources/views/CRUD/list_datetime.twig

@@ -9,7 +9,7 @@ file that was distributed with this source code.
 
 #}
 
-{% extends 'BaseApplicationBundle:CRUD:base_list_field.twig' %}
+{% extends 'Sonata/BaseApplicationBundle:CRUD:base_list_field.twig' %}
 
 {% block field%}{{ value|date }}{% endblock %}
 

+ 1 - 1
Resources/views/CRUD/list_decimal.twig

@@ -9,6 +9,6 @@ file that was distributed with this source code.
 
 #}
 
-{% extends 'BaseApplicationBundle:CRUD:base_list_field.twig' %}
+{% extends 'Sonata/BaseApplicationBundle:CRUD:base_list_field.twig' %}
 
 {% block field%}{{ value }}{% endblock %}

+ 1 - 1
Resources/views/CRUD/list_identifier.twig

@@ -8,4 +8,4 @@ For the full copyright and license information, please view the LICENSE
 file that was distributed with this source code.
 
 #}
-{% extends 'BaseApplicationBundle:CRUD:base_list_field.twig' %}
+{% extends 'Sonata/BaseApplicationBundle:CRUD:base_list_field.twig' %}

+ 1 - 1
Resources/views/CRUD/list_integer.twig

@@ -8,4 +8,4 @@ For the full copyright and license information, please view the LICENSE
 file that was distributed with this source code.
 
 #}
-{% extends 'BaseApplicationBundle:CRUD:base_list_field.twig' %}
+{% extends 'Sonata/BaseApplicationBundle:CRUD:base_list_field.twig' %}

+ 1 - 1
Resources/views/CRUD/list_many_to_one.twig

@@ -9,7 +9,7 @@ file that was distributed with this source code.
 
 #}
 
-{% extends 'BaseApplicationBundle:CRUD:base_list_field.twig' %}
+{% extends 'Sonata/BaseApplicationBundle:CRUD:base_list_field.twig' %}
 
 
 {% block field%}<a href="{{ field_description.configuration.generateUrl('edit', {'id': value.id}) }}">{{ value }}</a>{% endblock %}

+ 1 - 1
Resources/views/CRUD/list_string.twig

@@ -8,4 +8,4 @@ For the full copyright and license information, please view the LICENSE
 file that was distributed with this source code.
 
 #}
-{% extends 'BaseApplicationBundle:CRUD:base_list_field.twig' %}
+{% extends 'Sonata/BaseApplicationBundle:CRUD:base_list_field.twig' %}

+ 1 - 1
Resources/views/CRUD/list_text.twig

@@ -8,4 +8,4 @@ For the full copyright and license information, please view the LICENSE
 file that was distributed with this source code.
 
 #}
-{% extends 'BaseApplicationBundle:CRUD:base_list_field.twig' %}
+{% extends 'Sonata/BaseApplicationBundle:CRUD:base_list_field.twig' %}

+ 1 - 1
Resources/views/Core/dashboard.twig

@@ -9,7 +9,7 @@ file that was distributed with this source code.
 
 #}
 
-{% extends 'BaseApplicationBundle::standard_layout.twig' %}
+{% extends 'Sonata/BaseApplicationBundle::standard_layout.twig' %}
 
 {% block title %}{% trans 'title_dashboard' from 'BaseApplicationBundle' %}{% endblock%}
 {% block content %}

+ 1 - 1
Resources/views/standard_layout.twig

@@ -38,7 +38,7 @@ file that was distributed with this source code.
         <div class="container">
             <div class="span-24 last header">
                 <div class="span-20">
-                    <a href="{{ url('base_application_dashboard') }}" class="home">Admin</a>
+                    <a href="{{ url('sonata_base_application_dashboard') }}" class="home">Admin</a>
                 </div>
 
                 <div class="span-4 last">

+ 4 - 9
Tool/Datagrid.php

@@ -140,7 +140,7 @@ class Datagrid
 
     public function buildFilterFields()
     {
-        $this->filter_fields = \Bundle\BaseApplicationBundle\Admin\Admin::getBaseFields($this->getClassMetaData(), $this->filter_fields);
+        $this->filter_fields = \Bundle\Sonata\BaseApplicationBundle\Admin\Admin::getBaseFields($this->getClassMetaData(), $this->filter_fields);
 
         foreach($this->filter_fields as $name => $options) {
 
@@ -159,21 +159,16 @@ class Datagrid
 
             // fix template for mapping
             if($this->filter_fields[$name]['type'] == \Doctrine\ORM\Mapping\ClassMetadataInfo::MANY_TO_ONE) {
-                $this->filter_fields[$name]['template']       = 'BaseApplicationBundle:CRUD:filter_many_to_one.twig';
+                $this->filter_fields[$name]['template']       = 'Sonata/BaseApplicationBundle:CRUD:filter_many_to_one.twig';
             }
 
             if($this->filter_fields[$name]['type'] == \Doctrine\ORM\Mapping\ClassMetadataInfo::MANY_TO_MANY) {
-                $this->filter_fields[$name]['template']       = 'BaseApplicationBundle:CRUD:filter_many_to_many.twig';
+                $this->filter_fields[$name]['template']       = 'Sonata/BaseApplicationBundle:CRUD:filter_many_to_many.twig';
             }
 
             // define the default template
             if(!isset($this->filter_fields[$name]['template'])) {
-                $this->filter_fields[$name]['template'] = sprintf('BaseApplicationBundle:CRUD:filter_%s.twig', $this->filter_fields[$name]['type']);
-            }
-
-            // define the default template for identifier field
-            if(isset($this->filter_fields[$name]['id'])) {
-                $this->filter_fields[$name]['template'] = 'BaseApplicationBundle:CRUD:filter_identifier.twig';
+                $this->filter_fields[$name]['template'] = sprintf('Sonata/BaseApplicationBundle:CRUD:filter_%s.twig', $this->filter_fields[$name]['type']);
             }
 
             if(!isset($this->filter_fields[$name]['filter_value'])) {