crud: Custom Method class not found
I’m trying to add a custom action, following these instructions
http://crud.readthedocs.io/en/latest/actions/custom.html#using-custom-named-controller-actions
I have the following:
public function initialize() {
parent::initialize();
$this->loadComponent('Crud.Crud', [
'actions' => [
'test' => ['className' => 'App\Controller\test']
],
'listeners' => ['Crud.Api'],
],'RequestHandler'
);
$this->Crud->config(['listeners.api.exceptionRenderer' => 'App\Error\ExceptionRenderer']);
$this->Crud->addListener('relatedModels', 'Crud.RelatedModels');
}
public function beforeFilter(Event $event){
parent::beforeFilter($event);
$this->Crud->addListener('Crud.Api');
}
public function test() {
$this->Crud->execute();
}
When I call test.json I get the following:
message: “Class ‘App\Controller\TestAction’ not found”,
Also are the documents correct, it says to use: \App\Crud\Action\ but the top of my controller use the namespace: namespace App\Controller. I tried both but the result is the same - missing class.
What am I doing wrong?
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 22 (12 by maintainers)
Where is your TestAction class? I don’t see that in your screenshot, and you gisted the controller, not the action class.
What exactly are you trying to do?
Hi @josegonzalez as requested:
File Path:
The class:
https://gist.github.com/spacebiscuit/a1deaa477914e68ab731dfd776772690
I am calling: offers/test.json