bug #16232 Fix missing deprecation notice for type
(nicolas-grekas, WouterJ)
This PR was merged into the 2.8 branch. Discussion ---------- Fix missing deprecation notice for `type` | Q | A | ------------- | --- | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | yes | Tests pass? | yes | Fixed tickets | - | License | MIT | Doc PR | - Replaces https://github.com/symfony/symfony/pull/16231 Commits -------27517e3
Use entry_type instead of type87fdffa
[Form] Fix missing notice for deprecated `type`
This commit is contained in:
commit
72c6c61dbe
@ -92,6 +92,8 @@ class CollectionType extends AbstractType
|
|||||||
if (null !== $value) {
|
if (null !== $value) {
|
||||||
@trigger_error('The form option "type" is deprecated since version 2.8 and will be removed in 3.0. Use "entry_type" instead.', E_USER_DEPRECATED);
|
@trigger_error('The form option "type" is deprecated since version 2.8 and will be removed in 3.0. Use "entry_type" instead.', E_USER_DEPRECATED);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return $value;
|
||||||
};
|
};
|
||||||
$entryType = function (Options $options) {
|
$entryType = function (Options $options) {
|
||||||
if (null !== $options['type']) {
|
if (null !== $options['type']) {
|
||||||
@ -123,6 +125,7 @@ class CollectionType extends AbstractType
|
|||||||
'delete_empty' => false,
|
'delete_empty' => false,
|
||||||
));
|
));
|
||||||
|
|
||||||
|
$resolver->setNormalizer('type', $typeNormalizer);
|
||||||
$resolver->setNormalizer('options', $optionsNormalizer);
|
$resolver->setNormalizer('options', $optionsNormalizer);
|
||||||
$resolver->setNormalizer('entry_options', $entryOptionsNormalizer);
|
$resolver->setNormalizer('entry_options', $entryOptionsNormalizer);
|
||||||
}
|
}
|
||||||
|
@ -195,7 +195,7 @@ abstract class AbstractTableLayoutTest extends AbstractLayoutTest
|
|||||||
public function testCollection()
|
public function testCollection()
|
||||||
{
|
{
|
||||||
$form = $this->factory->createNamed('names', 'Symfony\Component\Form\Extension\Core\Type\CollectionType', array('a', 'b'), array(
|
$form = $this->factory->createNamed('names', 'Symfony\Component\Form\Extension\Core\Type\CollectionType', array('a', 'b'), array(
|
||||||
'type' => 'Symfony\Component\Form\Extension\Core\Type\TextType',
|
'entry_type' => 'Symfony\Component\Form\Extension\Core\Type\TextType',
|
||||||
));
|
));
|
||||||
|
|
||||||
$this->assertWidgetMatchesXpath($form->createView(), array(),
|
$this->assertWidgetMatchesXpath($form->createView(), array(),
|
||||||
@ -213,7 +213,7 @@ abstract class AbstractTableLayoutTest extends AbstractLayoutTest
|
|||||||
public function testEmptyCollection()
|
public function testEmptyCollection()
|
||||||
{
|
{
|
||||||
$form = $this->factory->createNamed('names', 'Symfony\Component\Form\Extension\Core\Type\CollectionType', array(), array(
|
$form = $this->factory->createNamed('names', 'Symfony\Component\Form\Extension\Core\Type\CollectionType', array(), array(
|
||||||
'type' => 'Symfony\Component\Form\Extension\Core\Type\TextType',
|
'entry_type' => 'Symfony\Component\Form\Extension\Core\Type\TextType',
|
||||||
));
|
));
|
||||||
|
|
||||||
$this->assertWidgetMatchesXpath($form->createView(), array(),
|
$this->assertWidgetMatchesXpath($form->createView(), array(),
|
||||||
|
@ -31,7 +31,7 @@ class CollectionTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
|
|||||||
public function testContainsNoChildByDefault()
|
public function testContainsNoChildByDefault()
|
||||||
{
|
{
|
||||||
$form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\CollectionType', null, array(
|
$form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\CollectionType', null, array(
|
||||||
'type' => 'Symfony\Component\Form\Extension\Core\Type\TextType',
|
'entry_type' => 'Symfony\Component\Form\Extension\Core\Type\TextType',
|
||||||
));
|
));
|
||||||
|
|
||||||
$this->assertCount(0, $form);
|
$this->assertCount(0, $form);
|
||||||
@ -305,10 +305,10 @@ class CollectionTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
|
|||||||
public function testPrototypeData()
|
public function testPrototypeData()
|
||||||
{
|
{
|
||||||
$form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\CollectionType', array(), array(
|
$form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\CollectionType', array(), array(
|
||||||
'type' => 'Symfony\Component\Form\Extension\Core\Type\TextType',
|
|
||||||
'allow_add' => true,
|
'allow_add' => true,
|
||||||
'prototype' => true,
|
'prototype' => true,
|
||||||
'prototype_data' => 'foo',
|
'prototype_data' => 'foo',
|
||||||
|
'entry_type' => 'Symfony\Component\Form\Extension\Core\Type\TextType',
|
||||||
'entry_options' => array(
|
'entry_options' => array(
|
||||||
'data' => 'bar',
|
'data' => 'bar',
|
||||||
),
|
),
|
||||||
|
Reference in New Issue
Block a user