简体   繁体   English

尝试从Silex的全局名称空间调用函数

[英]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.

相关问题 Symfony2 + Twig:尝试从全局名称空间调用函数“ replace” - Symfony2 + Twig: Attempted to call function “replace” from the global namespace 试图从全局命名空间调用函数“yaml_parse_file” - Attempted to call function "yaml_parse_file" from the global namespace 尝试从名称空间“ Controller”调用函数“ split” - Attempted to call function “split” from namespace “Controller” UndefinedFunctionException:尝试从命名空间Controller调用函数 - UndefinedFunctionException: Attempted to call function from namespace Controller 尝试从名称空间symfony Controller调用函数 - Attempted to call function from namespace symfony Controller 尝试从命名空间“App\Controller”调用 function - Attempted to call function from namespace “App\Controller” Symfony imap“试图从全局名称空间中调用函数“ imap_open”。 - Symfony imap “Attempted to call function ”imap_open“ from the global namespace.” 尝试从全局名称空间Symfony2 + Ekino Wordpress调用函数“ wp” - Attempted to call function “wp” from the global namespace Symfony2 + Ekino Wordpress 尝试在 Prestashop 中使用 Mail 方法时尝试从全局命名空间调用函数“idn_to_ascii” - Attempted to call function "idn_to_ascii" from the global namespace when trying to use Mail methods in Prestashop 尝试从名称空间“ App \\ Bundle \\ Controller”中调用函数“ getAge” - Attempted to call function “getAge” from namespace “App\Bundle\Controller”
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM