0

I need to set a varibiale from the AuthComponent

var $something = AuthComponent::user('group_id');

Gives me a syntax error in NetBeans. If I just set:

var $something = AuthComponent::user;

I dont get an error, but does this contain all the user data, and how do I then access it for a conditional key value pair?

'Group' => array(
            'className' => 'Group',
            'foreignKey' => 'group_id',
            'conditions' => '', // access the Auth Component here
            'fields' => '',
            'order' => ''
        ),
4

1 回答 1

0

您不能将方法设置为类的属性,因此会出现错误。控制器也在组件之前加载。

只需AuthComponent::user('group_id')在需要时使用或为其创建包装方法,就像$this->groupId()Auth 调用一样

于 2012-12-18T15:34:38.933 回答