Hi how can i do this,
$this->Components->load('api/UserComponent');
calling a component from folder structure like so:
app/Controller/Component/api/UserComponent.php
Hi how can i do this,
$this->Components->load('api/UserComponent');
calling a component from folder structure like so:
app/Controller/Component/api/UserComponent.php
just leaving ‘Component’ from name should be enough
$this->loadComponent('api/User');
alternatively:
i havent tried it but you can probably use className
for this
use app/Controller/Component/api/UserComponent;
...
$this->loadComponent('User', [
'className' => UserComponent::class
]);
I got it working now my stupid mistake forgot to add Component sufix the filename call
I followed cakephp 3 className
$this->loadComponent(‘User’, [ ‘className’ => UserComponent::class ]);
thanks for reply anyway