From 7eaeb69032e7b82f68869069b586f8dd0b60ae4d Mon Sep 17 00:00:00 2001 From: Joshua Thijssen Date: Thu, 3 Sep 2015 15:22:43 +0200 Subject: [PATCH] Added exception when setAutoInitialize is called when locked --- src/Symfony/Component/Form/FormConfigBuilder.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Symfony/Component/Form/FormConfigBuilder.php b/src/Symfony/Component/Form/FormConfigBuilder.php index bbe1914dec8b8..d217cf019365d 100644 --- a/src/Symfony/Component/Form/FormConfigBuilder.php +++ b/src/Symfony/Component/Form/FormConfigBuilder.php @@ -854,6 +854,10 @@ public function setRequestHandler(RequestHandlerInterface $requestHandler) */ 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;