Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AclExtras Warning Error

Tags:

cakephp

In CakePHP 2 book / Acl Tutorial / Part 2, I am executing the command:

./Console/cake AclExtras.AclExtras aco_sync

and I get a warning error:

Warning Error: Argument 1 passed to Component::startup() must be an instance of Controller, 
null given, called in 
/opt/lampp/htdocs/acl/app/Plugin/AclExtras/Console/Command/AclExtrasShell.php 
on line 80 and defined in [/opt/lampp/htdocs/acl/lib/Cake/Controller/Component.php, line 119]

The acos table gets populated with NULL in model field and NULL in all fields of the foreign_key.

How can I fix this error?

enter image description here

ThAnKs

like image 903
Ivan Santana Avatar asked Sep 30 '26 12:09

Ivan Santana


1 Answers

in AclExtras/Console/Command, please change startup function to :

public function startup() {
    parent::startup();
    $controller = new Controller();
    $collection = new ComponentCollection();
    $this->Acl = new AclComponent($collection);
    $this->Acl->startup($controller);
    $this->Aco = $this->Acl->Aco;
}
like image 140
mustapha Avatar answered Oct 02 '26 14:10

mustapha