Skip to content

Commit

Permalink
merged branch Tobion/deprecated-form-exception (PR #7927)
Browse files Browse the repository at this point in the history
This PR was merged into the master branch.

Discussion
----------

[Form] removed deprecated exceptions

Removed deprecated exceptions for 2.3.

| Q             | A
| ------------- | ---
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | -
| License       | MIT
| Doc PR        | -

Commits
-------

82ff360 [Form] removed deprecated exceptions
  • Loading branch information
fabpot committed May 4, 2013
2 parents 1df7876 + 82ff360 commit c8f95b5
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 61 deletions.
Expand Up @@ -11,7 +11,7 @@

namespace Symfony\Bridge\Doctrine\Form\ChoiceList;

use Symfony\Component\Form\Exception\Exception;
use Symfony\Component\Form\Exception\RuntimeException;
use Symfony\Component\Form\Exception\StringCastException;
use Symfony\Component\Form\Extension\Core\ChoiceList\ObjectChoiceList;
use Doctrine\Common\Persistence\ObjectManager;
Expand Down Expand Up @@ -406,12 +406,12 @@ private function load()
*
* @return array The identifier values
*
* @throws Exception If the entity does not exist in Doctrine's identity map
* @throws RuntimeException If the entity does not exist in Doctrine's identity map
*/
private function getIdentifierValues($entity)
{
if (!$this->em->contains($entity)) {
throw new Exception(
throw new RuntimeException(
'Entities passed to the choice field must be managed. Maybe ' .
'persist them in the entity manager?'
);
Expand Down
4 changes: 2 additions & 2 deletions src/Symfony/Bridge/Doctrine/Form/Type/DoctrineType.php
Expand Up @@ -12,7 +12,7 @@
namespace Symfony\Bridge\Doctrine\Form\Type;

use Doctrine\Common\Persistence\ManagerRegistry;
use Symfony\Component\Form\Exception\Exception;
use Symfony\Component\Form\Exception\RuntimeException;
use Doctrine\Common\Persistence\ObjectManager;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Bridge\Doctrine\Form\ChoiceList\EntityChoiceList;
Expand Down Expand Up @@ -144,7 +144,7 @@ public function setDefaultOptions(OptionsResolverInterface $resolver)
$em = $registry->getManagerForClass($options['class']);

if (null === $em) {
throw new Exception(sprintf(
throw new RuntimeException(sprintf(
'Class "%s" seems not to be a managed Doctrine entity. ' .
'Did you forget to map it?',
$options['class']
Expand Down
Expand Up @@ -70,7 +70,7 @@ protected function tearDown()
}

/**
* @expectedException \Symfony\Component\Form\Exception\FormException
* @expectedException \Symfony\Component\Form\Exception\StringCastException
* @expectedMessage Entity "Symfony\Bridge\Doctrine\Tests\Fixtures\SingleIdentEntity" passed to the choice field must have a "__toString()" method defined (or you can also override the "property" option).
*/
public function testEntitiesMustHaveAToStringMethod()
Expand All @@ -97,7 +97,7 @@ public function testEntitiesMustHaveAToStringMethod()
}

/**
* @expectedException \Symfony\Component\Form\Exception\FormException
* @expectedException \Symfony\Component\Form\Exception\RuntimeException
*/
public function testChoicesMustBeManaged()
{
Expand Down
Expand Up @@ -15,7 +15,6 @@
use \BaseObject;
use \Persistent;

use Symfony\Component\Form\Exception\FormException;
use Symfony\Component\Form\Exception\StringCastException;
use Symfony\Component\Form\Extension\Core\ChoiceList\ObjectChoiceList;
use Symfony\Component\PropertyAccess\PropertyAccessorInterface;
Expand Down Expand Up @@ -379,8 +378,6 @@ private function load()
* @param object $model The model for which to get the identifier
*
* @return array
*
* @throws FormException If the model does not exist
*/
private function getIdentifierValues($model)
{
Expand Down
26 changes: 0 additions & 26 deletions src/Symfony/Component/Form/Exception/Exception.php

This file was deleted.

Expand Up @@ -16,6 +16,6 @@
*
* @author Bernhard Schussek <bschussek@gmail.com>
*/
interface ExceptionInterface extends FormException
interface ExceptionInterface
{
}
24 changes: 0 additions & 24 deletions src/Symfony/Component/Form/Exception/FormException.php

This file was deleted.

0 comments on commit c8f95b5

Please sign in to comment.