Skip to content

Commit

Permalink
Merge pull request sonata-project#3407 from pulzarraider/autocompl_extd
Browse files Browse the repository at this point in the history
Removed type check of sonata_type_model_autocomplete to allow extending the form type.
  • Loading branch information
pulzarraider committed Nov 6, 2015
2 parents c61f7c7 + b08e87d commit 03f72ae
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 12 deletions.
4 changes: 0 additions & 4 deletions Controller/HelperController.php
Original file line number Diff line number Diff line change
Expand Up @@ -462,10 +462,6 @@ private function retrieveFormFieldDescription(AdminInterface $admin, $field)
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));
}
Expand Down
8 changes: 0 additions & 8 deletions Tests/Controller/HelperControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -537,10 +537,6 @@ public function testRetrieveAutocompleteItemsActionDisabledFormelememt()

$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'));
Expand Down Expand Up @@ -610,10 +606,6 @@ public function testRetrieveAutocompleteItemsActionNotGrantedTarget()

$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'));
Expand Down

0 comments on commit 03f72ae

Please sign in to comment.