CakePHP2からCakePHP3への変更点の人つとして、フォルダの拡張方法が大きく変わった。
Cake2では[app/Config/bootstrap.php]の設定で行っていたが、Cake3ではcomposerの利用を前提とした仕様に変わったため、この設定がなくなった。
Cake3では[composer.json]と[config/app.php]でフォルダの拡張を行う。
[composer.json]
各種クラスはこちらで設定する。
"autoload": {
"psr-4": {
"App\\": [
"models/Master",
"models/User",
"models/Common",
"apps/Auth",
"apps/Admin",
"apps/Manager",
"apps/Operator",
"apps/Customer",
"apps/Common",
"apps/Api",
"src"
]
}
},
上記の例では、[app]のフォルダを用途別に分類している。
[config/app.php]
クラス以外のViewテンプレートはこちらで設定する。
'App' => [
'namespace' => 'App',
ーーーーー省略ーーーーー
'paths' => [
'plugins' => [ROOT . DS . 'plugins' . DS],
'templates' => [
APP . 'Template' . DS,
ROOT . DS . 'apps' . DS . 'Auth' . DS . 'Template' . DS,
ROOT . DS . 'apps' . DS . 'Admin' . DS . 'Template' . DS,
ROOT . DS . 'apps' . DS . 'Manager' . DS . 'Template' . DS,
ROOT . DS . 'apps' . DS . 'Operator' . DS . 'Template' . DS,
ROOT . DS . 'apps' . DS . 'Customer' . DS . 'Template' . DS,
ROOT . DS . 'apps' . DS . 'Common' . DS . 'Template' . DS,
ROOT . DS . 'apps' . DS . 'Api' . DS . 'Template' . DS,
],
'locales' => [APP . 'Locale' . DS],
],
],