I have a problem. I lose SESSION when i want to get data by using $auth->hasIdentity(): MY code is below: This is my Bootstrap.php
public function _initSession(){
Zend_Session::start();
}
protected function _initDB(){
$db = Zend_Db::factory('PDO_MYSQL', array ('host' => 'localhost', 'username' => 'root',
'password' => '111111',
'dbname' => 'your_tour'));
$db->setFetchMode(Zend_Db::FETCH_BOTH);
Zend_Db_Table::setDefaultAdapter($db);
Zend_Registry::set('DB',$db);
return $db;
}
I write SESSION here (in loginAction) and it print the correct data when i use var_dump
$storage = $auth->getStorage();
$storage->write($authAdapter->getResultRowObject(null,'password'));
Zend_Session::rememberMe(3600); // remember me for one hour
//$sess->lock();
var_dump($_SESSION); //It shows the right data what I need to store ...
indexAction, I get SESSION but it's return nothing
var_dump(Zend_Session::isStarted()); //Check for the Zend_session::start and it's TRUE
$auth = Zend_Auth::getInstance();
if (!$auth->hasIdentity()){
var_dump('nothing'); //return nothing
}
$infoUser = $auth->getIdentity();
var_dump($infoUser->user_id); //return null
var_dump($_SESSION); //nothing in here
Any Ideas?