Bladeren bron

Removed type check of sonata_type_model_autocomplete to allow extending the form type.

Andrej Hudec 9 jaren geleden
bovenliggende
commit
b08e87d37a
2 gewijzigde bestanden met toevoegingen van 0 en 12 verwijderingen
  1. 0 4
      Controller/HelperController.php
  2. 0 8
      Tests/Controller/HelperControllerTest.php

+ 0 - 4
Controller/HelperController.php

@@ -462,10 +462,6 @@ class HelperController
             throw new \RuntimeException(sprintf('The field "%s" does not exist.', $field));
         }
 
-        if ($fieldDescription->getType() !== 'sonata_type_model_autocomplete') {
-            throw new \RuntimeException(sprintf('Unsupported form type "%s" for field "%s".', $fieldDescription->getType(), $field));
-        }
-
         if (null === $fieldDescription->getTargetEntity()) {
             throw new \RuntimeException(sprintf('No associated entity with field "%s".', $field));
         }

+ 0 - 8
Tests/Controller/HelperControllerTest.php

@@ -537,10 +537,6 @@ class HelperControllerTest extends \PHPUnit_Framework_TestCase
 
         $fieldDescription = $this->getMock('Sonata\AdminBundle\Admin\FieldDescriptionInterface');
 
-        $fieldDescription->expects($this->once())
-            ->method('getType')
-            ->will($this->returnValue('sonata_type_model_autocomplete'));
-
         $fieldDescription->expects($this->once())
             ->method('getTargetEntity')
             ->will($this->returnValue('Sonata\AdminBundle\Tests\Fixtures\Bundle\Entity\Foo'));
@@ -610,10 +606,6 @@ class HelperControllerTest extends \PHPUnit_Framework_TestCase
 
         $fieldDescription = $this->getMock('Sonata\AdminBundle\Admin\FieldDescriptionInterface');
 
-        $fieldDescription->expects($this->once())
-            ->method('getType')
-            ->will($this->returnValue('sonata_type_model_autocomplete'));
-
         $fieldDescription->expects($this->once())
             ->method('getTargetEntity')
             ->will($this->returnValue('Sonata\AdminBundle\Tests\Fixtures\Bundle\Entity\Foo'));