Using components in Cakephp 3+



 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
<?php
namespace App\Shell;

use Cake\Console\Shell;
use Cake\Controller\Component;
use Cake\Controller\ComponentRegistry;
use App\Controller\Component\YourComponent;

class YourShell extends Shell
{

    public function initialize()
    {
        parent::initialize();
        $this->Your = new YourComponent(new ComponentRegistry());
    }

    public function yourMethod()
    {
        $this->Your->component_method($params1);
    }



}

?>




Comments