开发者

Need help with Zend_Auth Storage

开发者 https://www.devze.com 2023-02-22 07:43 出处:网络
Currently I have this code (Fetching user informations from Database then store into Zend_Auth session storage)

Currently I have this code (Fetching user informations from Database then store into Zend_Auth session storage)

$auth = Zend_Auth::getInstance();
$storage = $auth->getStorage();
$storage->write($authAdapter->getResultRowObject(array('email', 'firstName', 'lastName', 'provide开发者_运维百科rId'))); // store into session

But now I wanted to store a role variable in the storage as well (the problem is that my user table doesn't have a role column therefore I wanted to add a role variable to the storage). So how can I add an extra role variable to the storage? is it possible?

Thanks so much !


I think i worked out here is my solution

        $storage = $auth->getStorage();
        $userInfo = $authAdapter->getResultRowObject(array('email', 'firstName', 'lastName','providerId'));
        $role = new stdClass;
        $userInfo->role = 'Provider';

         $storage->write($userInfo); // store into session

But unsure if I use stdClass is a good idea? any suggestion?

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号