Added exception when setAutoInitialize is called when locked

This commit is contained in:
Joshua Thijssen 2015-09-03 15:22:43 +02:00 committed by Fabien Potencier
parent 16ba4579a7
commit c269d6feda
1 changed files with 4 additions and 0 deletions

View File

@ -855,6 +855,10 @@ class FormConfigBuilder implements FormConfigBuilderInterface
*/
public function setAutoInitialize($initialize)
{
if ($this->locked) {
throw new BadMethodCallException('FormConfigBuilder methods cannot be accessed anymore once the builder is turned into a FormConfigInterface instance.');
}
$this->autoInitialize = (bool) $initialize;
return $this;