[Form] removed deprecated exceptions
This commit is contained in:
parent
a7608d9115
commit
82ff36055c
@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
namespace Symfony\Bridge\Doctrine\Form\ChoiceList;
|
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\Exception\StringCastException;
|
||||||
use Symfony\Component\Form\Extension\Core\ChoiceList\ObjectChoiceList;
|
use Symfony\Component\Form\Extension\Core\ChoiceList\ObjectChoiceList;
|
||||||
use Doctrine\Common\Persistence\ObjectManager;
|
use Doctrine\Common\Persistence\ObjectManager;
|
||||||
@ -406,12 +406,12 @@ class EntityChoiceList extends ObjectChoiceList
|
|||||||
*
|
*
|
||||||
* @return array The identifier values
|
* @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)
|
private function getIdentifierValues($entity)
|
||||||
{
|
{
|
||||||
if (!$this->em->contains($entity)) {
|
if (!$this->em->contains($entity)) {
|
||||||
throw new Exception(
|
throw new RuntimeException(
|
||||||
'Entities passed to the choice field must be managed. Maybe ' .
|
'Entities passed to the choice field must be managed. Maybe ' .
|
||||||
'persist them in the entity manager?'
|
'persist them in the entity manager?'
|
||||||
);
|
);
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
namespace Symfony\Bridge\Doctrine\Form\Type;
|
namespace Symfony\Bridge\Doctrine\Form\Type;
|
||||||
|
|
||||||
use Doctrine\Common\Persistence\ManagerRegistry;
|
use Doctrine\Common\Persistence\ManagerRegistry;
|
||||||
use Symfony\Component\Form\Exception\Exception;
|
use Symfony\Component\Form\Exception\RuntimeException;
|
||||||
use Doctrine\Common\Persistence\ObjectManager;
|
use Doctrine\Common\Persistence\ObjectManager;
|
||||||
use Symfony\Component\Form\FormBuilderInterface;
|
use Symfony\Component\Form\FormBuilderInterface;
|
||||||
use Symfony\Bridge\Doctrine\Form\ChoiceList\EntityChoiceList;
|
use Symfony\Bridge\Doctrine\Form\ChoiceList\EntityChoiceList;
|
||||||
@ -144,7 +144,7 @@ abstract class DoctrineType extends AbstractType
|
|||||||
$em = $registry->getManagerForClass($options['class']);
|
$em = $registry->getManagerForClass($options['class']);
|
||||||
|
|
||||||
if (null === $em) {
|
if (null === $em) {
|
||||||
throw new Exception(sprintf(
|
throw new RuntimeException(sprintf(
|
||||||
'Class "%s" seems not to be a managed Doctrine entity. ' .
|
'Class "%s" seems not to be a managed Doctrine entity. ' .
|
||||||
'Did you forget to map it?',
|
'Did you forget to map it?',
|
||||||
$options['class']
|
$options['class']
|
||||||
|
@ -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).
|
* @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()
|
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()
|
public function testChoicesMustBeManaged()
|
||||||
{
|
{
|
||||||
|
@ -15,7 +15,6 @@ use \ModelCriteria;
|
|||||||
use \BaseObject;
|
use \BaseObject;
|
||||||
use \Persistent;
|
use \Persistent;
|
||||||
|
|
||||||
use Symfony\Component\Form\Exception\FormException;
|
|
||||||
use Symfony\Component\Form\Exception\StringCastException;
|
use Symfony\Component\Form\Exception\StringCastException;
|
||||||
use Symfony\Component\Form\Extension\Core\ChoiceList\ObjectChoiceList;
|
use Symfony\Component\Form\Extension\Core\ChoiceList\ObjectChoiceList;
|
||||||
use Symfony\Component\PropertyAccess\PropertyAccessorInterface;
|
use Symfony\Component\PropertyAccess\PropertyAccessorInterface;
|
||||||
@ -379,8 +378,6 @@ class ModelChoiceList extends ObjectChoiceList
|
|||||||
* @param object $model The model for which to get the identifier
|
* @param object $model The model for which to get the identifier
|
||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*
|
|
||||||
* @throws FormException If the model does not exist
|
|
||||||
*/
|
*/
|
||||||
private function getIdentifierValues($model)
|
private function getIdentifierValues($model)
|
||||||
{
|
{
|
||||||
|
@ -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
|
|
||||||
{
|
|
||||||
}
|
|
@ -16,6 +16,6 @@ namespace Symfony\Component\Form\Exception;
|
|||||||
*
|
*
|
||||||
* @author Bernhard Schussek <bschussek@gmail.com>
|
* @author Bernhard Schussek <bschussek@gmail.com>
|
||||||
*/
|
*/
|
||||||
interface ExceptionInterface extends FormException
|
interface ExceptionInterface
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -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
|
|
||||||
{
|
|
||||||
}
|
|
Reference in New Issue
Block a user