8000 [Form] Renamed setVars() to addVars() in FormViewInterface · symfony/symfony@b61cc55 · GitHub
[go: up one dir, main page]

Skip to content

Commit b61cc55

Browse files
committed
[Form] Renamed setVars() to addVars() in FormViewInterface
1 parent e1f502b commit b61cc55

File tree

9 files changed

+12
-9
lines changed

9 files changed

+12
-9
lines changed

UPGRADE-2.1.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -748,6 +748,9 @@
748748
* `removeChild`: `remove`
749749
* `hasChild`: `has`
750750
751+
The new method `addVars` was added to make the definition of multiple
752+
variables at once more convenient.
753+
751754
The method `hasChildren` was deprecated. You should use `count` instead.
752755
753756
Before:

src/Symfony/Component/Form/Extension/Core/Type/CheckboxType.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public function buildForm(FormBuilderInterface $builder, array $options)
3535
*/
3636
public function buildView(FormViewInterface $view, FormInterface $form, array $options)
3737
{
38-
$view->setVars(array(
38+
$view->addVars(array(
3939
'value' => $options['value'],
4040
'checked' => null !== $form->getViewData(),
4141
));

src/Symfony/Component/Form/Extension/Core/Type/ChoiceType.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ public function buildForm(FormBuilderInterface $builder, array $options)
7575
*/
7676
public function buildView(FormViewInterface $view, FormInterface $form, array $options)
7777
{
78-
$view->setVars(array(
78+
$view->addVars(array(
7979
'multiple' => $options['multiple'],
8080
'expanded' => $options['expanded'],
8181
'preferred_choices' => $options['choice_list']->getPreferredViews(),

src/Symfony/Component/Form/Extension/Core/Type/CollectionType.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public function buildForm(FormBuilderInterface $builder, array $options)
4848
*/
4949
public function buildView(FormViewInterface $view, FormInterface $form, array $options)
5050
{
51-
$view->setVars(array(
51+
$view->addVars(array(
5252
'allow_add' => $options['allow_add'],
5353
'allow_delete' => $options['allow_delete'],
5454
));

src/Symfony/Component/Form/Extension/Core/Type/FileType.php

Lines changed: 1 addition & 1 de 8000 letion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class FileType extends AbstractType
2323
*/
2424
public function buildView(FormViewInterface $view, FormInterface $form, array $options)
2525
{
26-
$view->setVars(array(
26+
$view->addVars(array(
2727
'type' => 'file',
2828
'value' => '',
2929
));

src/Symfony/Component/Form/Extension/Core/Type/FormType.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ public function buildView(FormViewInterface $view, FormInterface $form, array $o
8989
$types[] = $type->getName();
9090
}
9191

92-
$view->setVars(array(
92+
$view->addVars(array(
9393
'form' => $view,
9494
'id' => $id,
9595
'name' => $name,

src/Symfony/Component/Form/Extension/Core/Type/TimeType.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ public function buildForm(FormBuilderInterface $builder, array $options)
115115
*/
116116
public function buildView(FormViewInterface $view, FormInterface $form, array $options)
117117
{
118-
$view->setVars(array(
118+
$view->addVars(array(
119119
'widget' => $options['widget'],
120120
'with_seconds' => $options['with_seconds'],
121121
));

src/Symfony/Component/Form/FormView.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ public function getVar($name, $default = null)
8484
/**
8585
* {@inheritdoc}
8686
*/
87-
public function setVars(array $vars)
87+
public function addVars(array $vars)
8888
{
8989
$this->vars = array_replace($this->vars, $vars);
9090

src/Symfony/Component/Form/FormViewInterface.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,13 +114,13 @@ function has($name);
114114
function setVar($name, $value);
115115

116116
/**
117-
* Sets a list of view variables.
117+
* Adds a list of view variables.
118118
*
119119
* @param array $values An array of variable names and values.
120120
*
121121
* @return FormViewInterface The view object.
122122
*/
123-
function setVars(array $values);
123+
function addVars(array $values);
124124

125125
/**
126126
* Returns whether a view variable exists.

0 commit comments

Comments
 (0)
0