Skip to content
Browse files

[DoctrineBridge] Require class option for DoctrineType

  • Loading branch information...
1 parent 4e3ea22 commit 3cc3c67e5a7d054f0aabb45adc1d28a36d53fd5b @jmikola jmikola committed Aug 17, 2012
View
3 src/Symfony/Bridge/Doctrine/Form/Type/DoctrineType.php
@@ -135,7 +135,6 @@ public function setDefaultOptions(OptionsResolverInterface $resolver)
$resolver->setDefaults(array(
'em' => null,
- 'class' => null,
'property' => null,
'query_builder' => null,
'loader' => $loader,
@@ -144,6 +143,8 @@ public function setDefaultOptions(OptionsResolverInterface $resolver)
'group_by' => null,
));
+ $resolver->setRequired(array('class'));
+
$resolver->setNormalizers(array(
'em' => $emNormalizer,
));
View
8 src/Symfony/Bridge/Doctrine/Tests/Form/Type/EntityTypeTest.php
@@ -110,6 +110,14 @@ protected function persist(array $entities)
// be managed!
}
+ /**
+ * @expectedException Symfony\Component\OptionsResolver\Exception\MissingOptionsException
+ */
+ public function testClassOptionIsRequired()
+ {
+ $this->factory->createNamed('name', 'entity');
+ }
+
public function testSetDataToUninitializedEntityWithNonRequired()
{
$entity1 = new SingleIdentEntity(1, 'Foo');

0 comments on commit 3cc3c67

Please sign in to comment.
Something went wrong with that request. Please try again.