Skip to content

Commit

Permalink
avoid deprecation notices
Browse files Browse the repository at this point in the history
  • Loading branch information
greg0ire committed Feb 5, 2016
1 parent ee5098f commit 7dbf119
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion Form/Type/CollectionType.php
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand All @@ -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';
}
}

/**
Expand Down
2 changes: 1 addition & 1 deletion Tests/Form/Widget/BaseWidgetTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public function setUp()
$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';
Expand Down

0 comments on commit 7dbf119

Please sign in to comment.