[Form] Renamed setVars() to addVars() in FormViewInterface

This commit is contained in:
Bernhard Schussek 2012-05-25 08:32:54 +02:00
parent 1c4f632f60
commit ee803cd948
9 changed files with 12 additions and 9 deletions

View File

@ -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:

View File

@ -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(),
));

View File

@ -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(),

View File

@ -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'],
));

View File

@ -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' => '',
));

View File

@ -89,7 +89,7 @@ class FormType extends AbstractType
$types[] = $type->getName();
}
$view->setVars(array(
$view->addVars(array(
'form' => $view,
'id' => $id,
'name' => $name,

View File

@ -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'],
));

View File

@ -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);

View File

@ -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.