[Form] Fix the fluid interface of FormBuilder
This commit is contained in:
parent
9cc7aacf76
commit
75a499b0e2
@ -558,6 +558,8 @@ class Form implements \IteratorAggregate, FormInterface
|
|||||||
foreach ($this->validators as $validator) {
|
foreach ($this->validators as $validator) {
|
||||||
$validator->validate($this);
|
$validator->validate($this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -568,6 +570,8 @@ class Form implements \IteratorAggregate, FormInterface
|
|||||||
*
|
*
|
||||||
* @param Request $request The request to bind to the form
|
* @param Request $request The request to bind to the form
|
||||||
*
|
*
|
||||||
|
* @return Form This form
|
||||||
|
*
|
||||||
* @throws FormException if the method of the request is not one of GET, POST or PUT
|
* @throws FormException if the method of the request is not one of GET, POST or PUT
|
||||||
*/
|
*/
|
||||||
public function bindRequest(Request $request)
|
public function bindRequest(Request $request)
|
||||||
@ -588,7 +592,7 @@ class Form implements \IteratorAggregate, FormInterface
|
|||||||
throw new FormException(sprintf('The request method "%s" is not supported', $request->getMethod()));
|
throw new FormException(sprintf('The request method "%s" is not supported', $request->getMethod()));
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->bind($data);
|
return $this->bind($data);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -604,9 +608,11 @@ class Form implements \IteratorAggregate, FormInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds an error to the field.
|
* Adds an error to this form.
|
||||||
*
|
*
|
||||||
* @see FormInterface
|
* @param FormError $error
|
||||||
|
*
|
||||||
|
* @return Form The current form
|
||||||
*/
|
*/
|
||||||
public function addError(FormError $error)
|
public function addError(FormError $error)
|
||||||
{
|
{
|
||||||
@ -615,6 +621,8 @@ class Form implements \IteratorAggregate, FormInterface
|
|||||||
} else {
|
} else {
|
||||||
$this->errors[] = $error;
|
$this->errors[] = $error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -754,6 +762,8 @@ class Form implements \IteratorAggregate, FormInterface
|
|||||||
* Adds a child to the form.
|
* Adds a child to the form.
|
||||||
*
|
*
|
||||||
* @param FormInterface $child The FormInterface to add as a child
|
* @param FormInterface $child The FormInterface to add as a child
|
||||||
|
*
|
||||||
|
* @return Form the current form
|
||||||
*/
|
*/
|
||||||
public function add(FormInterface $child)
|
public function add(FormInterface $child)
|
||||||
{
|
{
|
||||||
@ -764,12 +774,16 @@ class Form implements \IteratorAggregate, FormInterface
|
|||||||
if ($this->dataMapper) {
|
if ($this->dataMapper) {
|
||||||
$this->dataMapper->mapDataToForm($this->getClientData(), $child);
|
$this->dataMapper->mapDataToForm($this->getClientData(), $child);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Removes a child from the form.
|
* Removes a child from the form.
|
||||||
*
|
*
|
||||||
* @param string $name The name of the child to remove
|
* @param string $name The name of the child to remove
|
||||||
|
*
|
||||||
|
* @return Form the current form
|
||||||
*/
|
*/
|
||||||
public function remove($name)
|
public function remove($name)
|
||||||
{
|
{
|
||||||
@ -778,6 +792,8 @@ class Form implements \IteratorAggregate, FormInterface
|
|||||||
|
|
||||||
unset($this->children[$name]);
|
unset($this->children[$name]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user