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 type
87fdffa [Form] Fix missing notice for deprecated `type`
This commit is contained in:
Fabien Potencier 2015-10-16 13:53:17 +02:00
commit 72c6c61dbe
3 changed files with 7 additions and 4 deletions

View File

@ -92,6 +92,8 @@ class CollectionType extends AbstractType
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);
}
return $value;
};
$entryType = function (Options $options) {
if (null !== $options['type']) {
@ -123,6 +125,7 @@ class CollectionType extends AbstractType
'delete_empty' => false,
));
$resolver->setNormalizer('type', $typeNormalizer);
$resolver->setNormalizer('options', $optionsNormalizer);
$resolver->setNormalizer('entry_options', $entryOptionsNormalizer);
}

View File

@ -195,7 +195,7 @@ abstract class AbstractTableLayoutTest extends AbstractLayoutTest
public function testCollection()
{
$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(),
@ -213,7 +213,7 @@ abstract class AbstractTableLayoutTest extends AbstractLayoutTest
public function testEmptyCollection()
{
$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(),

View File

@ -31,7 +31,7 @@ class CollectionTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
public function testContainsNoChildByDefault()
{
$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);
@ -305,10 +305,10 @@ class CollectionTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
public function testPrototypeData()
{
$form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\CollectionType', array(), array(
'type' => 'Symfony\Component\Form\Extension\Core\Type\TextType',
'allow_add' => true,
'prototype' => true,
'prototype_data' => 'foo',
'entry_type' => 'Symfony\Component\Form\Extension\Core\Type\TextType',
'entry_options' => array(
'data' => 'bar',
),