FatalErrorException:错误:找不到类“Symfony\Component\Debug\Exception\FlattenException" [英] FatalErrorException: Error: Class 'Symfony\Component\Debug\Exception\FlattenException' not found
问题描述
我使用了 Sonata admin/userBundle 和 FosUserBundle,但是当我查看个人资料页面/profile"时,我收到了这个奇怪的错误:
I use sonata admin/userBundle and FosUserBundle but when I check the profile page "/profile",I get this strange error :
FatalErrorException: Error: Class 'Symfony\Component\Debug\Exception\FlattenException' not found in /var/www/project/vendor/sonata-project/user-bundle/Sonata/UserBundle/Block/ProfileMenuBlockService.php line 97
推荐答案
几周前我遇到了同样的错误.我第一次听说扁平化异常.
I got the same error a few weeks ago. First time I ever heard of a flattened exception.
我有一个带有两个派生控制器类(AccountController 和 PersonController)的 BaseController 类
I have a BaseController class with two derived controller classes (AccountController and PersonController)
每个派生控制器都有一个带有不同参数的 createModel() 方法.我决定通过向 BaseController 添加 createModel() 方法来清理这些东西.我从 PersonController 开始,一切都很好.
Each of the derived controllers had a createModel() method with different arguments. I decided to clean things up by adding a createModel() method to the BaseController. I started with PersonController and all seemed well.
然后我清除了开发缓存,突然出现扁平化异常错误.缓存创建过程中的某些内容已确定 AccountController::createModel() 的参数与 BaseController::createModel() 中的参数不匹配.PHP 不在乎,因为 AccountController 从来没有调用 BaseController::createModel.但是缓存构建器是.修正参数解决了问题.
I then cleared the development cache and suddenly got the flattened exception error. Something in the cache creation process had determined that the arguments to AccountController::createModel() did not match the arguments in BaseController::createModel(). PHP did not care since AccountController was never calling BaseController::createModel. But the cache builder was. Fixing the arguments solved the problem.
这个问题并没有让我们继续深入,但您可以查看您可能进行的任何继承类型更改.
The question does not give us much to go on but you might take a look at any inheritance type changes that you may have made.
这篇关于FatalErrorException:错误:找不到类“Symfony\Component\Debug\Exception\FlattenException"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!