From 82ff36055ca7ce4fad66f2eda8f64e35cba567f3 Mon Sep 17 00:00:00 2001 From: Tobias Schultze Date: Sat, 4 May 2013 02:14:05 +0200 Subject: [PATCH] [Form] removed deprecated exceptions --- .../Form/ChoiceList/EntityChoiceList.php | 6 ++--- .../Doctrine/Form/Type/DoctrineType.php | 4 +-- .../Form/ChoiceList/EntityChoiceListTest.php | 4 +-- .../Form/ChoiceList/ModelChoiceList.php | 3 --- .../Component/Form/Exception/Exception.php | 26 ------------------- .../Form/Exception/ExceptionInterface.php | 2 +- .../Form/Exception/FormException.php | 24 ----------------- 7 files changed, 8 insertions(+), 61 deletions(-) delete mode 100644 src/Symfony/Component/Form/Exception/Exception.php delete mode 100644 src/Symfony/Component/Form/Exception/FormException.php diff --git a/src/Symfony/Bridge/Doctrine/Form/ChoiceList/EntityChoiceList.php b/src/Symfony/Bridge/Doctrine/Form/ChoiceList/EntityChoiceList.php index fabd25f7c200..74042a7b41a3 100644 --- a/src/Symfony/Bridge/Doctrine/Form/ChoiceList/EntityChoiceList.php +++ b/src/Symfony/Bridge/Doctrine/Form/ChoiceList/EntityChoiceList.php @@ -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; @@ -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?' ); diff --git a/src/Symfony/Bridge/Doctrine/Form/Type/DoctrineType.php b/src/Symfony/Bridge/Doctrine/Form/Type/DoctrineType.php index df6f2077f80e..81623966c108 100644 --- a/src/Symfony/Bridge/Doctrine/Form/Type/DoctrineType.php +++ b/src/Symfony/Bridge/Doctrine/Form/Type/DoctrineType.php @@ -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; @@ -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'] diff --git a/src/Symfony/Bridge/Doctrine/Tests/Form/ChoiceList/EntityChoiceListTest.php b/src/Symfony/Bridge/Doctrine/Tests/Form/ChoiceList/EntityChoiceListTest.php index a3ce7503436c..cce457879834 100644 --- a/src/Symfony/Bridge/Doctrine/Tests/Form/ChoiceList/EntityChoiceListTest.php +++ b/src/Symfony/Bridge/Doctrine/Tests/Form/ChoiceList/EntityChoiceListTest.php @@ -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() @@ -97,7 +97,7 @@ public function testEntitiesMustHaveAToStringMethod() } /** - * @expectedException \Symfony\Component\Form\Exception\FormException + * @expectedException \Symfony\Component\Form\Exception\RuntimeException */ public function testChoicesMustBeManaged() { diff --git a/src/Symfony/Bridge/Propel1/Form/ChoiceList/ModelChoiceList.php b/src/Symfony/Bridge/Propel1/Form/ChoiceList/ModelChoiceList.php index b2d9b52cad56..589c0235f5d2 100644 --- a/src/Symfony/Bridge/Propel1/Form/ChoiceList/ModelChoiceList.php +++ b/src/Symfony/Bridge/Propel1/Form/ChoiceList/ModelChoiceList.php @@ -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; @@ -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) { diff --git a/src/Symfony/Component/Form/Exception/Exception.php b/src/Symfony/Component/Form/Exception/Exception.php deleted file mode 100644 index b882d70396f1..000000000000 --- a/src/Symfony/Component/Form/Exception/Exception.php +++ /dev/null @@ -1,26 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Form\Exception; - -/** - * Base exception class. - * - * @author Bernhard Schussek - * - * @deprecated This class is a replacement for when class FormException was - * used previously. It should not be used and will be removed. - * Occurrences of this class should be replaced by more specialized - * exception classes, preferably derived from SPL exceptions. - */ -class Exception extends \Exception implements ExceptionInterface -{ -} diff --git a/src/Symfony/Component/Form/Exception/ExceptionInterface.php b/src/Symfony/Component/Form/Exception/ExceptionInterface.php index 975bdb89adbc..d455932edfaf 100644 --- a/src/Symfony/Component/Form/Exception/ExceptionInterface.php +++ b/src/Symfony/Component/Form/Exception/ExceptionInterface.php @@ -16,6 +16,6 @@ * * @author Bernhard Schussek */ -interface ExceptionInterface extends FormException +interface ExceptionInterface { } diff --git a/src/Symfony/Component/Form/Exception/FormException.php b/src/Symfony/Component/Form/Exception/FormException.php deleted file mode 100644 index dbc6d06499f1..000000000000 --- a/src/Symfony/Component/Form/Exception/FormException.php +++ /dev/null @@ -1,24 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Form\Exception; - -/** - * Alias of {@link ExceptionInterface}. - * - * @author Bernhard Schussek - * - * @deprecated This interface was deprecated and will be removed in Symfony 2.3. - * You should code against {@link ExceptionInterface} instead. - */ -interface FormException -{ -}