Dear Friends,
We are using Friendsofcake’s Crud component in our project, and we came to know that initialize Crud component in AppController and other controllers both are working fine.
AppController.php
namespace App\Controller;
class AppController extends \Cake\Controller\Controller
{
use \Crud\Controller\ControllerTrait;
public function initialize()
{
parent::initialize();
$this->loadComponent('Crud.Crud', [
'actions' => [
'Crud.Index',
'Crud.Add',
'Crud.Edit',
'Crud.View',
'Crud.Delete'
]
]);
}
}
PagesController.php
namespace App\Controller;
class PagesController extends AppController
{
use \Crud\Controller\ControllerTrait;
public function initialize()
{
parent::initialize();
$this->loadComponent('Crud.Crud', [
'actions' => [
'Crud.Index',
'Crud.Add',
'Crud.Edit',
'Crud.View',
'Crud.Delete'
]
]);
}
}
So please kindly let me know which one is standard? or there is no difference between both? or loading component in PagesController.php will impact on performance?