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

Popular posts from this blog

CakePHP 4: Firebase Cloud Messaging Component in CakePHP for Push Notification

CakePHP 4 : Using Component inside Command ( Shell )

CakePHP: COUNT data and GROUP BY date