且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

FatalErrorException:错误:找不到类“Symfony\Component\Debug\Exception\FlattenException"

更新时间:2022-01-18 21:24:12

几周前我遇到了同样的错误.我第一次听说扁平化异常.

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.