EDIT: I forget 'return'.

You can also extend Zend_Auth like this:

class App_Auth extends Zend_Auth {

   protected $_user;

   public function getUser() 
   {
       if ( $this->hasIdentity() && !$this->_user ) {
             $table = new Model_DbTable_Users();
             $this->_user = $table->find( $this->getIdentity() )->current();
        } else {
             $this->_user = null;
        }
        return $this->_user;
   }
}

And then you can use:

$user = null;
$auth = App_Auth::getInstance();
if ( $auth->hasIdentity() ) {
   ...
   $user = $auth->getUser();
} else {
   ...
}

Thomas


-- 
List: [email protected]
Info: http://framework.zend.com/archives
Unsubscribe: [email protected]


Reply via email to