Browse Source

avoid deprecation notices

Grégoire Paris 9 years ago
parent
commit
7dbf1193a7
2 changed files with 7 additions and 2 deletions
  1. 6 1
      Form/Type/CollectionType.php
  2. 1 1
      Tests/Form/Widget/BaseWidgetTest.php

+ 6 - 1
Form/Type/CollectionType.php

@@ -12,6 +12,7 @@
 namespace Sonata\AdminBundle\Form\Type;
 
 use Symfony\Component\Form\AbstractType;
+use Symfony\Component\HttpKernel\Kernel;
 
 /**
  * This type wrap native `collection` form type and render `add` and `delete`
@@ -26,7 +27,11 @@ class CollectionType extends AbstractType
      */
     public function getParent()
     {
-        return 'collection';
+        if (version_compare(Kernel::VERSION, '2.8.0', '>=')) {
+            return 'Symfony\Component\Form\Extension\Core\Type\CollectionType';
+        } else {
+            return 'collection';
+        }
     }
 
     /**

+ 1 - 1
Tests/Form/Widget/BaseWidgetTest.php

@@ -57,7 +57,7 @@ abstract class BaseWidgetTest extends TypeTestCase
             $this->type.'_admin_fields.html.twig',
         ));
 
-        if (version_compare(Kernel::VERSION, '3.0.0', '>=')) {
+        if (version_compare(Kernel::VERSION, '2.8.0', '>=')) {
             $csrfManagerClass = 'Symfony\Component\Security\Csrf\CsrfTokenManagerInterface';
         } else {
             $csrfManagerClass = 'Symfony\Component\Form\Extension\Csrf\CsrfProvider\CsrfProviderInterface';