Thats it! Thanks so much for the quick help.


Fabien MARTY wrote:
> 
> Hi,
> 
> You have to "require_once" all needed classes before unserialize the
> object
> 
> from unserialize() manual :
> 
> ----------------------------------------------------------------------------------------------------------------------------------------------
> *[...]
> unserialize_callback_func directive: * It's possible to set a
> callback-function which will be called, if an undefined class should be
> instantiated during unserializing. (to prevent getting an incomplete
> object<http://fr3.php.net/manual/en/language.types.object.php>"__PHP_Incomplete_Class".)
> Use your
> php.ini, ini_set() <http://fr3.php.net/manual/en/function.ini-set.php> or
> .htaccess to define 'unserialize_callback_func'. Everytime an undefined
> class should be instantiated, it'll be called. To disable this feature
> just
> empty this setting.
> [...]
> ----------------------------------------------------------------------------------------------------------------------------------------------
> 
> Regards
> 
> 2007/10/20, lroot <[EMAIL PROTECTED]>:
>>
>> I'm running threw a simple Zend framework tutorial trying to familiarize
>> myself with the framework. I have a simple application that stores and
>> displays cd albums and artist names. My problem lies in my index action
>> where I generate the full list. On the first load of the this action I do
>> a
>> fectchAll from my Zend DB Table object and save the result with Zend
>> Cache
>> and then send the result to the view which loops through the result and
>> displays it. The first load works fine. On subsequent loads I try to load
>> the date from Zend Cache and send it on to the view. However this time
>> the
>> view throws an error/notice: Notice: Trying to get property of non-object
>> in... When I do a Zend Debug Dump of the result of the Zend Cache load it
>> *appears* that what was returned was the proper object:
>>
>> object(__PHP_Incomplete_Class)#21 (8) {
>>   ["__PHP_Incomplete_Class_Name"] => string(20) "Zend_Db_Table_Rowset"
>>   ["_data:protected"] => array(4) {
>>     [0] => array(3) {
>>       ["id"] => string(3) "330"
>>       ["artist"] => string(15) "Michael Jackson"
>>       ["title"] => string(8) "Thriller"
>>     }
>>     [1] => array(3) {
>>       ["id"] => string(3) "331"
>>       ["artist"] => string(5) "AC/DC"
>>       ["title"] => string(13) "Back in Black"
>>     }
>>     [2] => array(3) {
>>       ["id"] => string(3) "332"
>>       ["artist"] => string(15) "Backstreet Boys"
>>       ["title"] => string(10) "Millennium"
>>     }
>>     [3] => array(3) {
>>       ["id"] => string(3) "334"
>>       ["artist"] => string(4) "asdf"
>>       ["title"] => string(4) "asdf"
>>     }
>>   }
>>   ["_tableClass:protected"] => string(5) "Album"
>>   ["_rowClass:protected"] => string(17) "Zend_Db_Table_Row"
>>   ["_pointer:protected"] => int(0)
>>   ["_count:protected"] => int(4)
>>   ["_rows:protected"] => array(0) {
>>   }
>>   ["_stored:protected"] => bool(true)
>> }
>>
>> From what I can tell I think I have everything setup properly based on
>> what i was able to scrounge up online. Any insight or advice would be
>> greatly appreciated. ### System & app Details PHP Version
>> 5.2.0-8+etch7(Debian) Apache2 ### Front Controller
>>
>> set('config',$config);
>>
>> //Setup Database
>> $db =
>> Zend_Db::factory($config->db->adapter,$config->db->config->toArray());
>> Zend_Db_Table::setDefaultAdapter($db);
>>
>> //Setup Cache
>> $frontendOptions = array(
>>   'lifetime' => 7200, // cache lifetime of 2 hours
>>   'automatic_serialization' => true
>> );
>> $backendOptions = array(
>>   'cache_dir' => '../cache/' // Directory where to put the cache files
>> );
>> $cache = Zend_Cache::factory('Core', 'File', $frontendOptions,
>> $backendOptions);
>> $registry->set('cache',$cache);
>>
>> //Setup Controller
>> $frontController = Zend_Controller_Front::getInstance();
>> $frontController->throwExceptions(true);
>> $frontController->setControllerDirectory('../application/controllers');
>>
>> $frontController->dispatch();
>>
>> ### Index action
>>
>> function indexAction() {
>>   $this->view->title = "My Albums";
>>   $cache = Zend_Registry::get('cache');
>>   $allAlbums = $cache->load('all_albums');
>>   Zend_Debug::dump($allAlbums);
>>   if ( $allAlbums ) {
>>     Zend_Debug::dump("Pulling from cache");
>>     $this->view->albums = $allAlbums;
>>   } else {
>>     Zend_Debug::dump("Pulling from DB");
>>     $album = new Album();
>>     $this->view->albums = $album->fetchAll();
>>     $cache->save($this->view->albums,'all_albums');
>>   }
>> }
>>
>> ### View
>>
>> albums as $album) : ?>
>>
>>     escape($album->title);?>
>>     escape($album->artist);?>
>>
>>       baseUrl; ?>/index/edit/id/id;?>">Edit
>> <http://%3C?php+echo+$this-+target=>
>>       baseUrl; ?>/index/delete/id/id;?>">Delete
>> <http://%3C?php+echo+$this-+target=>
>>
>>
>>
>> ------------------------------
>> View this message in context: Zend Cache dosent seem to be returning the
>> object I
>> saved<http://www.nabble.com/Zend-Cache-dosent-seem-to-be-returning-the-object-I-saved-tf4656895s16154.html#a13306864>
>> Sent from the Zend Framework mailing list
>> archive<http://www.nabble.com/Zend-Framework-f15440.html>at
>> Nabble.com.
>>
> 
> 
> 
> -- 
> Fabien MARTY
> [EMAIL PROTECTED]
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Zend-Cache-dosent-seem-to-be-returning-the-object-I-saved-tf4656895s16154.html#a13322296
Sent from the Zend Framework mailing list archive at Nabble.com.

Reply via email to