Hello,

When I try to print the identity :
$auth = Zend_Auth::getInstance();
$logger->debug($auth->hasIdentity());  // prints 1
$logger->debug($auth->getIdentity());  // prints exception

I have the following exception :
Catchable fatal error: Object of class stdClass could not be converted to
string in D:\websites\mysite\library\Zend\Log\Formatter\Simple.php on line
70

Though, I think it should returns me the username.

This is my auth code:

// in bootstrap
[...]
$authAdapter = new MyZend_Auth_Adapter_DbTable($dbAdapter);
$authAdapter->setTableName('members')
            ->setIdentityColumn('username')
            ->setCredentialColumn('password')
            ->setCodeColumn('code');
Zend_Registry::set('authAdapter', $authAdapter);
[...]

// in authController
[...]
$result = $authAdapter->authenticate();
[...]
case MyZend_Auth_Result::SUCCESS:
        $omit = array(
                'id_member',
                'password',
                'email',
                'date_of_birth',
                'country',
                'code',
                'valid_code'
        );
        $data = $authAdapter->getResultRowObject(null, $omit);
        
        $logger->debug(print_r($data, true));
        /* PRINTS :
        2007-09-20T12:19:22+02:00 DEBUG (7): stdClass Object
        (
            [username] => mathi
        )
        */
        
        $auth = Zend_Auth::getInstance();
        $auth->getStorage()->write($data);
        $logger->debug($auth->hasIdentity());
        $logger->debug($auth->getIdentity());  // <- EXCEPTION
        
        break;
[...]

Thank you.
-- 
View this message in context: 
http://www.nabble.com/Zend_Auth-%3A-getIdentity-issue-tf4486708s16154.html#a12794585
Sent from the Zend Framework mailing list archive at Nabble.com.

Reply via email to