It is very simple. I write
$auth->getStorage()->write($user);
And then I want to load this $ user in a separate process, but I cannot, because
$user = $auth->getIdentity();
is empty. Aren't I just ... INSTALLING? Why is this not working? Halp?
[EDIT 2011-04-13]
This was requested almost two years ago. The fact, however, is that I repeated this question in July 2010 and received a fantastic answer, which I simply did not understand then.
Link: Zend_Auth cannot write to storage
Since then I have created a very nice litte class that I use (sometimes with additional customization) in all my projects, using the same storage mechanism as Zend_Auth, but bypassing all the bad ones.
<?php
class Qapacity_Helpers_Storage {
public function save($name = 'default', $data) {
$session = new Zend_Session_Namespace($name);
$session->data = $data;
return true;
}
public function load($name = 'default', $part = null) {
$session = new Zend_Session_Namespace($name);
if (!isset($session->data))
return null;
$data = $session->data;
if ($part && isset($data[$part]))
return $data[$part];
return $data;
}
public function clear($name = 'default') {
$session = new Zend_Session_Namespace($name);
if (isset($session->data))
unset($session->data);
return true;
}
}
?>
source
share