File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed
src/Symfony/Bridge/Doctrine/Form/Type Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change 12
12
namespace Symfony \Bridge \Doctrine \Form \Type ;
13
13
14
14
use Doctrine \Common \Persistence \ManagerRegistry ;
15
+ use Symfony \Component \Form \Exception \FormException ;
15
16
use Doctrine \Common \Persistence \ObjectManager ;
16
17
use Symfony \Component \Form \FormBuilderInterface ;
17
18
use Symfony \Bridge \Doctrine \Form \ChoiceList \EntityChoiceList ;
@@ -130,7 +131,17 @@ public function setDefaultOptions(OptionsResolverInterface $resolver)
130
131
return $ registry ->getManager ($ em );
131
132
}
132
133
133
- return $ registry ->getManagerForClass ($ options ['class ' ]);
134
+ $ em = $ registry ->getManagerForClass ($ options ['class ' ]);
135
+
136
+ if (null === $ em ) {
137
+ throw new FormException (sprintf (
138
+ 'Class "%s" seems not to be a managed Doctrine entity. ' .
139
+ 'Did you forget to map it? ' ,
140
+ $ options ['class ' ]
141
+ ));
142
+ }
143
+
144
+ return $ em ;
134
145
};
135
146
136
147
$ resolver ->setDefaults (array (
You can’t perform that action at this time.
0 commit comments