[英]Attempted to call function from the global namespace on Silex
I have this error when I call my route. 呼叫路线时出现此错误。
Attempted to call function "VisiteurType" from the global namespace.
However I have the line 但是我有线
use PPE_PHP\\Form\\Type\\VisiteurType;
But this is never used. 但这是从未使用过的。 The file exist :
该文件存在:
On the call, VisiteurType()is indefined : 在通话中,VisitoreurType()未定义:
$app->match('/admin/visiteur/add', function(Request $request) use ($app) { $visiteur = new Visiteur(); $visiteurForm = $app['form.factory']->create(VisiteurType(), $visiteur); $visiteurForm->handleRequest($request); if ($visiteurForm->isSubmitted() && $visiteurForm->isValid()) { $app['dao.visiteur']->save($visiteur); $app['session']->getFlashBag()->add('success', 'Le visiteur a bien été créé.'); } return $app['twig']->render('visiteur_form.html.twig', array( 'nom' => 'Nouveau visiteur', 'visiteurForm' => $visiteurForm->createView())); })->bind('admin_visiteur_add');
I don't understand when is my error. 我不知道什么时候是我的错误。
form.factory的第一个参数必须是字符串( 请参阅doc )。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.