[Form] fixed deprecation triggers, removed usage of deprecated features
This commit is contained in:
parent
8d4fcc0798
commit
60bc402f8c
@ -11,8 +11,6 @@
|
||||
|
||||
namespace Symfony\Component\Form\Exception;
|
||||
|
||||
trigger_error('The '.__NAMESPACE__.'\AlreadyBoundException class is deprecated since version 2.3 and will be removed in 3.0. Use the Symfony\Component\Form\Exception\AlreadySubmittedException class instead.', E_USER_DEPRECATED);
|
||||
|
||||
/**
|
||||
* Alias of {@link AlreadySubmittedException}.
|
||||
*
|
||||
@ -21,4 +19,12 @@ trigger_error('The '.__NAMESPACE__.'\AlreadyBoundException class is deprecated s
|
||||
*/
|
||||
class AlreadyBoundException extends LogicException
|
||||
{
|
||||
public function __construct($message = '', $code = 0, \Exception $previous = null)
|
||||
{
|
||||
if (__CLASS__ === get_class($this)) {
|
||||
trigger_error('The '.__CLASS__.' class is deprecated since version 2.3 and will be removed in 3.0. Use the Symfony\Component\Form\Exception\AlreadySubmittedException class instead.', E_USER_DEPRECATED);
|
||||
}
|
||||
|
||||
parent::__construct($message, $code, $previous);
|
||||
}
|
||||
}
|
||||
|
@ -127,8 +127,8 @@ class ViolationMapper implements ViolationMapperInterface
|
||||
$scope->addError(new FormError(
|
||||
$violation->getMessage(),
|
||||
$violation->getMessageTemplate(),
|
||||
$violation->getMessageParameters(),
|
||||
$violation->getMessagePluralization(),
|
||||
$violation->getParameters(),
|
||||
$violation->getPlural(),
|
||||
$violation
|
||||
));
|
||||
}
|
||||
|
@ -791,8 +791,10 @@ class CompoundFormTest extends AbstractFormTest
|
||||
$this->assertEquals(array('extra' => 'data'), $form->getExtraData());
|
||||
}
|
||||
|
||||
public function testGetErrorsAsStringDeep()
|
||||
public function testLegacyGetErrorsAsStringDeep()
|
||||
{
|
||||
$this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED);
|
||||
|
||||
$parent = $this->getBuilder()
|
||||
->setCompound(true)
|
||||
->setDataMapper($this->getDataMapper())
|
||||
@ -810,8 +812,10 @@ class CompoundFormTest extends AbstractFormTest
|
||||
);
|
||||
}
|
||||
|
||||
public function testGetErrorsAsStringDeepWithIndentation()
|
||||
public function testLegacyGetErrorsAsStringDeepWithIndentation()
|
||||
{
|
||||
$this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED);
|
||||
|
||||
$parent = $this->getBuilder()
|
||||
->setCompound(true)
|
||||
->setDataMapper($this->getDataMapper())
|
||||
|
@ -637,8 +637,10 @@ class FormTypeTest extends BaseTypeTest
|
||||
$this->assertSame('0', $view->vars['label']);
|
||||
}
|
||||
|
||||
public function testCanGetErrorsWhenButtonInForm()
|
||||
public function testLegacyCanGetErrorsWhenButtonInForm()
|
||||
{
|
||||
$this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED);
|
||||
|
||||
$builder = $this->factory->createBuilder('form', null, array(
|
||||
'data_class' => 'Symfony\Component\Form\Tests\Fixtures\Author',
|
||||
'required' => false,
|
||||
|
@ -575,7 +575,7 @@ class FormValidatorTest extends AbstractConstraintValidatorTest
|
||||
->add($this->getBuilder('child'))
|
||||
->getForm();
|
||||
|
||||
$form->bind(array('foo' => 'bar'));
|
||||
$form->submit(array('foo' => 'bar'));
|
||||
|
||||
$context->expects($this->never())
|
||||
->method('addViolation');
|
||||
|
@ -733,8 +733,10 @@ class SimpleFormTest extends AbstractFormTest
|
||||
$this->assertSame($view, $form->createView($parentView));
|
||||
}
|
||||
|
||||
public function testGetErrorsAsString()
|
||||
public function testLegacyGetErrorsAsString()
|
||||
{
|
||||
$this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED);
|
||||
|
||||
$this->form->addError(new FormError('Error!'));
|
||||
|
||||
$this->assertEquals("ERROR: Error!\n", $this->form->getErrorsAsString());
|
||||
|
Reference in New Issue
Block a user