[Form] Renamed setVars() to addVars() in FormViewInterface
This commit is contained in:
parent
1c4f632f60
commit
ee803cd948
@ -748,6 +748,9 @@
|
||||
* `removeChild`: `remove`
|
||||
* `hasChild`: `has`
|
||||
|
||||
The new method `addVars` was added to make the definition of multiple
|
||||
variables at once more convenient.
|
||||
|
||||
The method `hasChildren` was deprecated. You should use `count` instead.
|
||||
|
||||
Before:
|
||||
|
@ -35,7 +35,7 @@ class CheckboxType extends AbstractType
|
||||
*/
|
||||
public function buildView(FormViewInterface $view, FormInterface $form, array $options)
|
||||
{
|
||||
$view->setVars(array(
|
||||
$view->addVars(array(
|
||||
'value' => $options['value'],
|
||||
'checked' => null !== $form->getViewData(),
|
||||
));
|
||||
|
@ -75,7 +75,7 @@ class ChoiceType extends AbstractType
|
||||
*/
|
||||
public function buildView(FormViewInterface $view, FormInterface $form, array $options)
|
||||
{
|
||||
$view->setVars(array(
|
||||
$view->addVars(array(
|
||||
'multiple' => $options['multiple'],
|
||||
'expanded' => $options['expanded'],
|
||||
'preferred_choices' => $options['choice_list']->getPreferredViews(),
|
||||
|
@ -48,7 +48,7 @@ class CollectionType extends AbstractType
|
||||
*/
|
||||
public function buildView(FormViewInterface $view, FormInterface $form, array $options)
|
||||
{
|
||||
$view->setVars(array(
|
||||
$view->addVars(array(
|
||||
'allow_add' => $options['allow_add'],
|
||||
'allow_delete' => $options['allow_delete'],
|
||||
));
|
||||
|
@ -23,7 +23,7 @@ class FileType extends AbstractType
|
||||
*/
|
||||
public function buildView(FormViewInterface $view, FormInterface $form, array $options)
|
||||
{
|
||||
$view->setVars(array(
|
||||
$view->addVars(array(
|
||||
'type' => 'file',
|
||||
'value' => '',
|
||||
));
|
||||
|
@ -89,7 +89,7 @@ class FormType extends AbstractType
|
||||
$types[] = $type->getName();
|
||||
}
|
||||
|
||||
$view->setVars(array(
|
||||
$view->addVars(array(
|
||||
'form' => $view,
|
||||
'id' => $id,
|
||||
'name' => $name,
|
||||
|
@ -115,7 +115,7 @@ class TimeType extends AbstractType
|
||||
*/
|
||||
public function buildView(FormViewInterface $view, FormInterface $form, array $options)
|
||||
{
|
||||
$view->setVars(array(
|
||||
$view->addVars(array(
|
||||
'widget' => $options['widget'],
|
||||
'with_seconds' => $options['with_seconds'],
|
||||
));
|
||||
|
@ -84,7 +84,7 @@ class FormView implements \IteratorAggregate, FormViewInterface
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function setVars(array $vars)
|
||||
public function addVars(array $vars)
|
||||
{
|
||||
$this->vars = array_replace($this->vars, $vars);
|
||||
|
||||
|
@ -114,13 +114,13 @@ interface FormViewInterface extends \ArrayAccess, \Traversable, \Countable
|
||||
function setVar($name, $value);
|
||||
|
||||
/**
|
||||
* Sets a list of view variables.
|
||||
* Adds a list of view variables.
|
||||
*
|
||||
* @param array $values An array of variable names and values.
|
||||
*
|
||||
* @return FormViewInterface The view object.
|
||||
*/
|
||||
function setVars(array $values);
|
||||
function addVars(array $values);
|
||||
|
||||
/**
|
||||
* Returns whether a view variable exists.
|
||||
|
Reference in New Issue
Block a user