i am using doctrine 2 with Zend Framework 1.10. i stored my whole doctrine (entity) user object in Zend_Session (default using Zend_Auth::authenticate()),
// in my Auth Adapter ... $em = Zend_Registry::get('em'); $query = $em->createQuery('select u from Application\Models\User u WHERE u.name = :username') ->setParameter('username', $this->username); $user = $query->getSingleResult(); // login success ... return new Zend_Auth_Result(Zend_Auth_Result::SUCCESS, $user);
if b4 the return, i try to do
$user->id // returns 1 (correct) $em->contains($user); // true
if i try the same in a method elsewhere (in this case my posts model class)
$user = Zend_Auth::getInstance()->getIdentity(); $em->contains($user); // returns false $user->name // returns correctly ... $user->id // is null/empty
so the things that changed is that id is null, and it seems unmanaged/detached by doctrine
View this message in context: Anything that might change my identity stored in Zend_Auth/Session?
Sent from the Zend Auth mailing list archive at Nabble.com.
没有评论:
发表评论