1

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', 'providerId'))); // 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 !

bensiu
  • 24,660
  • 56
  • 77
  • 117
user648198
  • 2,004
  • 4
  • 19
  • 26

1 Answers1

3

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?

user648198
  • 2,004
  • 4
  • 19
  • 26