瀏覽代碼

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

Andrej Hudec 9 年之前
父節點
當前提交
b08e87d37a
共有 2 個文件被更改,包括 0 次插入12 次删除
  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'));