Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
merged branch jmikola/2.1-doctrine-type-option (PR #5632)
This PR was merged into the 2.1 branch.

Commits
-------

3cc3c67 [DoctrineBridge] Require class option for DoctrineType

Discussion
----------

[DoctrineBridge] Require class option for DoctrineType

This is a resubmission of #5289 against the 2.1 branch.

```
Bug fix: yes
Feature addition: no
Backwards compatibility break: no
Symfony2 tests pass: yes
Fixes the following tickets: -
Todo: -
License of the code: MIT
Documentation PR: -
```

---------------------------------------------------------------------------

by stof at 2012-10-01T11:28:39Z

:+1:
  • Loading branch information
fabpot committed Oct 1, 2012
2 parents cab4f16 + 3cc3c67 commit 7b22da6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/Symfony/Bridge/Doctrine/Form/Type/DoctrineType.php
Expand Up @@ -135,7 +135,6 @@ public function setDefaultOptions(OptionsResolverInterface $resolver)

$resolver->setDefaults(array(
'em' => null,
'class' => null,
'property' => null,
'query_builder' => null,
'loader' => $loader,
Expand All @@ -144,6 +143,8 @@ public function setDefaultOptions(OptionsResolverInterface $resolver)
'group_by' => null,
));

$resolver->setRequired(array('class'));

$resolver->setNormalizers(array(
'em' => $emNormalizer,
));
Expand Down
Expand Up @@ -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');
Expand Down

0 comments on commit 7b22da6

Please sign in to comment.