[Form] removed deprecated exceptions

This commit is contained in:
Tobias Schultze 2013-05-04 02:14:05 +02:00
parent a7608d9115
commit 82ff36055c
7 changed files with 8 additions and 61 deletions

View File

@ -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 @@ class EntityChoiceList extends ObjectChoiceList
*
* @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?'
);

View File

@ -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 @@ abstract class DoctrineType extends AbstractType
$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']

View File

@ -70,7 +70,7 @@ class EntityChoiceListTest extends DoctrineOrmTestCase
}
/**
* @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 @@ class EntityChoiceListTest extends DoctrineOrmTestCase
}
/**
* @expectedException \Symfony\Component\Form\Exception\FormException
* @expectedException \Symfony\Component\Form\Exception\RuntimeException
*/
public function testChoicesMustBeManaged()
{

View File

@ -15,7 +15,6 @@ use \ModelCriteria;
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 @@ class ModelChoiceList extends ObjectChoiceList
* @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)
{

View File

@ -1,26 +0,0 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* 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 <bschussek@gmail.com>
*
* @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
{
}

View File

@ -16,6 +16,6 @@ namespace Symfony\Component\Form\Exception;
*
* @author Bernhard Schussek <bschussek@gmail.com>
*/
interface ExceptionInterface extends FormException
interface ExceptionInterface
{
}

View File

@ -1,24 +0,0 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* 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 <bschussek@gmail.com>
*
* @deprecated This interface was deprecated and will be removed in Symfony 2.3.
* You should code against {@link ExceptionInterface} instead.
*/
interface FormException
{
}