I am using zend session, it workssetting up on the index page and if i use jquery's and check any session data. how ever within my class the session is empty?
index.php
$usersession = new Zend_Session_Namespace();
$usersession->surveyType = array("2D","3D");
$usersession->surveyTypeSelect = 'all';
file i use for jquery
$session = new Zend_Session_Namespace();
$log = $session->log;
$cache = $session->cache;
$surveyType = $session->surveyType;
$surveyTypeSelect = $session->surveyTypeSelect;
my class
$seismicLibrary = new Spectrum_Seismic_Library();
Any function within this class returns empty values for my saved session data.
public function getAllSurveysByRegionId($regionId, $published = false) {
//'Default'
$session = new Zend_Session_Namespace();
$log = $session->log;
/*foreach ($session as $index => $value) {
$log->debug(print_r("aNamespace->$index = '$value';\n",true));
}*/
$surveyType = $session->surveyType;
$surveyTypeSelect = $session->surveyTypeSelect;
The above function - session data is empty.
You are setting a new session namespace in that function rather than retrieving the one you already had. You could try creating your session, then setting it to registry using
Zend_Registry::set('session', $session)
then when you need it anywhere else you use$session = Zend_Registry::get('session');
that way you ensure that you are using the same session namespace.