AclExtras警告错误

时间:2012-07-22 02:42:41

标签: cakephp

CakePHP 2 book / Acl Tutorial / Part 2中,我正在执行命令:

./Console/cake AclExtras.AclExtras aco_sync

我收到警告错误:

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]

acos表格填充了NULL字段中的modelNULL所有字段中的foreign_key

如何解决此错误?

enter image description here

感谢

1 个答案:

答案 0 :(得分:9)

在AclExtras / Console / Command中,请将启动功能更改为:

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;
}