From fb4eb9c2e957ee9e9c59cfe36a2fbbecc4e6e6bc Mon Sep 17 00:00:00 2001 From: Ryan Weaver Date: Thu, 21 Apr 2011 19:51:10 -0500 Subject: [PATCH] [FrameworkBundle] Adding check for invalid form type for better exception message --- .../Bundle/FrameworkBundle/Form/ContainerAwareTypeLoader.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Symfony/Bundle/FrameworkBundle/Form/ContainerAwareTypeLoader.php b/src/Symfony/Bundle/FrameworkBundle/Form/ContainerAwareTypeLoader.php index 95dcf10d72..03369a6fca 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Form/ContainerAwareTypeLoader.php +++ b/src/Symfony/Bundle/FrameworkBundle/Form/ContainerAwareTypeLoader.php @@ -28,7 +28,9 @@ class ContainerAwareTypeLoader implements TypeLoaderInterface public function getType($identifier) { - // TODO check whether identifier exists + if (!isset($this->serviceIds[$identifier])) { + throw new \InvalidArgumentException(sprintf('The field type "%s" is not registered with the service container.', $identifier)); + } return $this->container->get($this->serviceIds[$identifier]); }