0
0

More than 3 years have passed since last update.

🍰【CakePHP2】Error: Call to a member function dispatchMethod() on nullは環境設定で修正

Last updated at Posted at 2020-02-13

環境

PHP 7.2.21
CakePHP 2.10.18

やりたいこと

下記のエラーを修正

Error: Call to a member function dispatchMethod() on null
#0 (Modelのファイルパス)(223): Model->__call('makeRoleTargetJ...', Array)
#1 [internal function]: (対象のModel名)->__construct(Array)
#2 /(CakePHPディレクトリ)/Vendor/cakephp/cakephp/lib/Cake/Utility/ClassRegistry.php(169): ReflectionClass->newInstance(Array)
#3 /(CakePHPディレクトリ)/Vendor/cakephp/cakephp/lib/Cake/Console/Shell.php(316): ClassRegistry::init('(対象のModel名)')
#4 /(CakePHPディレクトリ)/Vendor/cakephp/cakephp/lib/Cake/Console/Shell.php(269): Shell->loadModel('(対象のModel名)')
#5 /(CakePHPディレクトリ)/Vendor/cakephp/cakephp/lib/Cake/Console/Shell.php(228): Shell->_loadModels()
#6 /(CakePHPディレクトリ)/Vendor/cakephp/cakephp/lib/Cake/Console/ShellDispatcher.php(221): Shell->initialize()
#7 /(CakePHPディレクトリ)/Vendor/cakephp/cakephp/lib/Cake/Console/ShellDispatcher.php(66): ShellDispatcher->dispatch()
#8 /(CakePHPディレクトリ)/(Projectディレクトリ)/Console/cake.php(48): ShellDispatcher::run(Array)
#9 {main}

やったこと

env.phpの環境変数を確認して修正する
ModelやControllerは悪くなかった

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0