我正在将CakePHP从版本3.9迁移到4.2,我看到了错误:
Exception: Call to undefined method Cake\Core\Plugin::load()
在config/bootstrap_cli.php
中的以下行上
Plugin::load('Bake');
看起来Core
或Plugin
没有正确导入。在config/bootstrap_cli.php
的前面,我有:
use Cake\Core\Plugin;
也许它没有被正确安装?我的composer.json
包含以下内容:
"require": {
"php": ">=5.4.16",
"cakephp/cakephp": "^4.0",
"mobiledetect/mobiledetectlib": "2.*",
"cakephp/migrations": "~3.0",
"cakephp/plugin-installer": "^1.0",
"phpunit/phpunit": "^8.0",
"cakephp/bake": "^2.0",
"cakephp/core": "^4.0"
},
"autoload": {
"psr-4": {
"App\\": "src"
}
},
"autoload-dev": {
"psr-4": {
"App\\Test\\": "tests",
"Cake\\Test\\": "./vendor/cakephp/cakephp/tests"
}
},
"scripts": {
"post-install-cmd": "App\\Console\\Installer::postInstall",
"post-autoload-dump": "Cake\\Composer\\Installer\\PluginInstaller::postAutoloadDump"
},
1条答案
按热度按时间6ojccjat1#
从CakePHP v4开始,就没有这样的方法了。在升级之前,你应该检查是否有过时的消息:v3.9最新版本中的代码为您的问题提供了一条重要信息:
@deprecated 3.7.0此方法将在4.0.0中移除。请改用Application::addPlugin()。