Selaa lähdekoodia

Merge branch '2.3'

Conflicts:
	.travis.yml
	Admin/Admin.php
	Admin/AdminExtension.php
	Admin/AdminExtensionInterface.php
	Admin/AdminHelper.php
	Admin/AdminInterface.php
	Admin/BaseFieldDescription.php
	Admin/FieldDescriptionInterface.php
	Admin/Pool.php
	Block/AdminListBlockService.php
	Block/AdminSearchBlockService.php
	Controller/CRUDController.php
	Datagrid/Datagrid.php
	Datagrid/DatagridInterface.php
	Datagrid/DatagridMapper.php
	Datagrid/ListMapper.php
	Datagrid/Pager.php
	Datagrid/ProxyQueryInterface.php
	DependencyInjection/AbstractSonataAdminExtension.php
	DependencyInjection/Compiler/AddDependencyCallsCompilerPass.php
	DependencyInjection/Configuration.php
	DependencyInjection/SonataAdminExtension.php
	Event/ConfigureEvent.php
	Event/ConfigureQueryEvent.php
	Event/PersistenceEvent.php
	Filter/Filter.php
	Form/DataTransformer/ModelToIdPropertyTransformer.php
	Form/DataTransformer/ModelToIdTransformer.php
	Form/Extension/Field/Type/FormTypeFieldExtension.php
	Form/Extension/Field/Type/MopaCompatibilityTypeFieldExtension.php
	Form/FormMapper.php
	Form/Type/AdminType.php
	Form/Type/Filter/ChoiceType.php
	Form/Type/Filter/DateRangeType.php
	Form/Type/Filter/DateTimeRangeType.php
	Form/Type/Filter/DateTimeType.php
	Form/Type/Filter/DateType.php
	Form/Type/Filter/DefaultType.php
	Form/Type/Filter/NumberType.php
	Form/Type/ModelAutocompleteType.php
	Form/Type/ModelHiddenType.php
	Form/Type/ModelReferenceType.php
	Form/Type/ModelType.php
	Form/Type/ModelTypeList.php
	Mapper/BaseGroupedMapper.php
	Mapper/BaseMapper.php
	Resources/doc/reference/dashboard.rst
	Resources/views/CRUD/base_edit_form.html.twig
	Resources/views/CRUD/base_edit_form_macro.html.twig
	Resources/views/Form/form_admin_fields.html.twig
	Route/RouteCollection.php
	Security/Handler/AclSecurityHandler.php
	Security/Handler/RoleSecurityHandler.php
	Show/ShowMapper.php
	SonataAdminBundle.php
	Tests/Admin/AdminTest.php
	Tests/Admin/BaseFieldDescriptionTest.php
	Tests/Admin/PoolTest.php
	Tests/Command/ExplainAdminCommandTest.php
	Tests/Command/GenerateAdminCommandTest.php
	Tests/Controller/CRUDControllerTest.php
	Tests/Controller/HelperControllerTest.php
	Tests/Datagrid/DatagridMapperTest.php
	Tests/Datagrid/ListMapperTest.php
	Tests/DependencyInjection/Compiler/AddDependencyCallsCompilerPassTest.php
	Tests/DependencyInjection/Compiler/ExtensionCompilerPassTest.php
	Tests/DependencyInjection/ConfigurationTest.php
	Tests/Export/ExporterTest.php
	Tests/Form/Builder/FormBuilder.php
	Tests/Form/DataTransformer/ModelsToArrayTransformerTest.php
	Tests/Form/FormMapperTest.php
	Tests/Model/AuditManagerTest.php
	Tests/Route/AdminPoolLoaderTest.php
	Tests/Show/ShowMapperTest.php
	Tests/SonataAdminBundleTest.php
	Tests/Translator/Extractor/JMSTranslatorBundle/AdminExtractorTest.php
	Tests/Twig/Extension/SonataAdminExtensionTest.php
	Tests/Util/AdminObjectAclDataTest.php
	Tests/Validator/Constraints/InlineConstraintTest.php
	Tests/Validator/ErrorElementTest.php
	Twig/Extension/SonataAdminExtension.php
	Util/AdminObjectAclData.php
	Util/AdminObjectAclManipulator.php
	Validator/Constraints/InlineConstraint.php
	Validator/ErrorElement.php
	Validator/InlineValidator.php
	composer.json
Sullivan SENECHAL 9 vuotta sitten
vanhempi
commit
cc8d3e9af9

+ 1 - 3
Block/AdminSearchBlockService.php

@@ -23,9 +23,7 @@ use Symfony\Component\OptionsResolver\OptionsResolverInterface;
 use Symfony\Component\Security\Core\Exception\AccessDeniedException;
 use Symfony\Component\Security\Core\Exception\AccessDeniedException;
 
 
 /**
 /**
- * Class AdminSearchBlockService.
- *
- * @author  Thomas Rabaix <thomas.rabaix@sonata-project.org>
+ * @author Thomas Rabaix <thomas.rabaix@sonata-project.org>
  */
  */
 class AdminSearchBlockService extends BaseBlockService
 class AdminSearchBlockService extends BaseBlockService
 {
 {

+ 1 - 1
Datagrid/ListMapper.php

@@ -75,7 +75,7 @@ class ListMapper extends BaseMapper
         // Change deprecated inline action "view" to "show"
         // Change deprecated inline action "view" to "show"
         if ($name == '_action' && $type == 'actions') {
         if ($name == '_action' && $type == 'actions') {
             if (isset($fieldDescriptionOptions['actions']['view'])) {
             if (isset($fieldDescriptionOptions['actions']['view'])) {
-                trigger_error('Inline action "view" is deprecated since version 2.2.4. Use inline action "show" instead.', E_USER_DEPRECATED);
+                @trigger_error('Inline action "view" is deprecated since version 2.2.4. Use inline action "show" instead.', E_USER_DEPRECATED);
 
 
                 $fieldDescriptionOptions['actions']['show'] = $fieldDescriptionOptions['actions']['view'];
                 $fieldDescriptionOptions['actions']['show'] = $fieldDescriptionOptions['actions']['view'];
 
 

+ 1 - 1
Form/Type/ModelHiddenType.php

@@ -20,7 +20,7 @@ use Symfony\Component\OptionsResolver\OptionsResolverInterface;
 /**
 /**
  * This type define a standard hidden field, that stored id to a object.
  * This type define a standard hidden field, that stored id to a object.
  *
  *
- * @author  Andrej Hudec <pulzarraider@gmail.com>
+ * @author Andrej Hudec <pulzarraider@gmail.com>
  */
  */
 class ModelHiddenType extends AbstractType
 class ModelHiddenType extends AbstractType
 {
 {

+ 2 - 2
Resources/doc/reference/action_create_edit.rst

@@ -34,13 +34,13 @@ When adding a form group to your edit/create form, you may specify some options
 - ``description``: to complete
 - ``description``: to complete
 - ``translation_domain``: to complete
 - ``translation_domain``: to complete
 
 
-To specify options, do as follow:
+To specify options, do as follows:
 
 
 .. code-block:: php
 .. code-block:: php
 
 
     <?php
     <?php
 
 
-    MyAdmin extends Admin
+    class MyAdmin extends Admin
     {
     {
         # ...
         # ...
 
 

+ 1 - 1
Resources/doc/reference/field_types.rst

@@ -142,7 +142,7 @@ Parameters:
     $listMapper->add('content', 'html', array('strip' => true));
     $listMapper->add('content', 'html', array('strip' => true));
 
 
     // Output for value `<p><strong>Creating a Template for the Field</strong> and form</p>`:
     // Output for value `<p><strong>Creating a Template for the Field</strong> and form</p>`:
-    // `Créer un Template pour...`
+    // `Creating a Template for...`
     $listMapper->add('content', 'html', array('truncate' => true));
     $listMapper->add('content', 'html', array('truncate' => true));
 
 
     // Output for value `<p><strong>Creating a Template for the Field</strong> and form</p>`:
     // Output for value `<p><strong>Creating a Template for the Field</strong> and form</p>`:

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

@@ -116,6 +116,8 @@ The permissions are:
 Each permission is relative to an admin: if you try to get a list in FooAdmin (declared as ``sonata.admin.demo.foo``
 Each permission is relative to an admin: if you try to get a list in FooAdmin (declared as ``sonata.admin.demo.foo``
 service), Sonata will check if the user has the ``ROLE_SONATA_ADMIN_DEMO_FOO_EDIT`` role.
 service), Sonata will check if the user has the ``ROLE_SONATA_ADMIN_DEMO_FOO_EDIT`` role.
 
 
+The role name will be based on the name of your admin service. For instance, `acme.blog.post.admin` will become `ROLE_ACME_BLOG_POST_ADMIN_{ACTION}`.
+
 So our ``security.yml`` file may look to something like this:
 So our ``security.yml`` file may look to something like this:
 
 
 .. configuration-block::
 .. configuration-block::

+ 0 - 24
Tests/Datagrid/ListMapperTest.php

@@ -119,30 +119,8 @@ class ListMapperTest extends \PHPUnit_Framework_TestCase
         $this->assertEquals('fooName', $fieldDescription->getOption('label'));
         $this->assertEquals('fooName', $fieldDescription->getOption('label'));
     }
     }
 
 
-    public function testAddViewInlineActionException()
-    {
-        set_error_handler('PHPUnit_Util_ErrorHandler::handleError');
-
-        $this->setExpectedException('PHPUnit_Framework_Error', 'Inline action "view" is deprecated since version 2.2.4. Use inline action "show" instead.');
-
-        try {
-            $this->assertFalse($this->listMapper->has('_action'));
-            $this->listMapper->add('_action', 'actions', array('actions' => array('view' => array())));
-        } catch (\PHPUnit_Framework_Error $e) {
-            restore_error_handler();
-
-            if ('Inline action "view" is deprecated since version 2.2.4. Use inline action "show" instead.' === $e->getMessage()) {
-                throw $e;
-            }
-        }
-
-        restore_error_handler();
-    }
-
     public function testAddViewInlineAction()
     public function testAddViewInlineAction()
     {
     {
-        $terminateErrorIgnore = \PHPUnit_Util_ErrorHandler::handleErrorOnce(E_USER_DEPRECATED);
-
         $this->assertFalse($this->listMapper->has('_action'));
         $this->assertFalse($this->listMapper->has('_action'));
         $this->listMapper->add('_action', 'actions', array('actions' => array('view' => array())));
         $this->listMapper->add('_action', 'actions', array('actions' => array('view' => array())));
 
 
@@ -154,8 +132,6 @@ class ListMapperTest extends \PHPUnit_Framework_TestCase
         $this->assertEquals('_action', $fieldDescription->getName());
         $this->assertEquals('_action', $fieldDescription->getName());
         $this->assertCount(1, $fieldDescription->getOption('actions'));
         $this->assertCount(1, $fieldDescription->getOption('actions'));
         $this->assertEquals(array('show' => array()), $fieldDescription->getOption('actions'));
         $this->assertEquals(array('show' => array()), $fieldDescription->getOption('actions'));
-
-        $terminateErrorIgnore();
     }
     }
 
 
     public function testAddRemove()
     public function testAddRemove()

+ 2 - 1
Tests/Export/ExporterTest.php

@@ -41,7 +41,8 @@ class ExporterTest extends \PHPUnit_Framework_TestCase
 
 
         $this->assertInstanceOf('Symfony\Component\HttpFoundation\Response', $response);
         $this->assertInstanceOf('Symfony\Component\HttpFoundation\Response', $response);
         $this->assertEquals($contentType, $response->headers->get('Content-Type'));
         $this->assertEquals($contentType, $response->headers->get('Content-Type'));
-        $this->assertEquals('attachment; filename="'.$filename.'"', $response->headers->get('Content-Disposition'));
+        // Quotes does not appear on some sonata versions.
+        $this->assertRegExp('/attachment; filename="?'.$filename.'"?/', $response->headers->get('Content-Disposition'));
     }
     }
 
 
     public function getGetResponseTests()
     public function getGetResponseTests()