0

I am having this issue with Zend and Doctrine and I am hoping someone can help me understand what I am doing wrong:-

My login controller is as follow:

....    
if ($result->isValid()) {

   $session = new Zend_Session_Namespace('tcc.auth');

      $identity = $adapter->getResultArray('password');

      $auth->getStorage()->write($identity); 
.....

In my index controller dispatch I call

$session = new Zend_Session_Namespace('tcc.auth');

what is not working as I hoped is that if I do this:

print_r (Zend_Auth::getInstance()->getIdentity());

I get the all Array correctly, bit if I want to get ie userid only and do this:

Zend_Auth::getInstance()->getIdentity()->userid;

I get nothing. It is just empty!

I am puzzled about what I am doing wrong. Can someone please please help?

FFSS
  • 133
  • 2
  • 10
  • and what does `$identity` store ? – Poelinca Dorin Nov 22 '11 at 11:32
  • The all user information -> the array – FFSS Nov 22 '11 at 11:36
  • 2
    Maybe I'm mistaken, but if it's returning an array, shouldn't it be retrieved using array indices? $identity = Zend_Auth::getInstance()->getIdentity(); $userId = $identity['userid']; – dinopmi Nov 22 '11 at 12:06
  • dinopmi! You have been my savior other times..and this time too. Thank god you are here!. It does work that way...I really appreciate your reply. Thank you very much. – FFSS Nov 22 '11 at 12:19
  • Glad to be able to help... I'm converting my comment into an answer for the posterity ;) – dinopmi Nov 22 '11 at 12:29

1 Answers1

2

Maybe I'm mistaken, but if it's an array, wouldn't this be the proper way to retrieve it?

$identity = Zend_Auth::getInstance()->getIdentity();
$userId = $identity['userid'];

Hope that helps,

dinopmi
  • 2,683
  • 19
  • 24