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?

ThAnKs
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;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With