piszę klasę do cechowania w Zend Frameworku, jednak mam pewien problem. Klasa wygląda tak:
class Application_Model_Cache { // nazwa cache private $name; protected $frontendOptions; protected $backendOptions; public $cache; public function __construct(){ // opcje frontend 'lifetime' => null, 'automatic_serialization' => true ); // opcje backendu 'cache_dir' => '../cache/' ); // cache $this->cache = Zend_Cache::factory('Core', 'File', $this->frontendOptions, $this->backendOptions); } /**Metoda ustawiająca nazwę*/ public function cacheSetName($name){ $this->name = $name; } /**Zwraca cache*/ public function cacheGetData(){ } /**Zapisuje cache*/ public function cacheSaveData($data){ $this->cache->save($data, $this->name); } /**Czyści cache*/ public function cacheDelData(){ $this->cache->remove($this->name); } }
Jak widać w metodach cacheDelData(), cacheSaveData() i cacheGetData() wywołuję funkcję gettype() z parametrem $this->cache;
Wszystko wywołuję tak:
$cache = new Application_Model_Cache(); $cache->cacheSetName('nazwa'); $cache->cacheGetData(); $cache->cacheDelData();
Metody cacheSaveData() i cacheDelData() wyświetlają mi 'object', tylko cacheSaveData() zwraca mi NULL i 'object'.
O co może chodzić? Nie rozumiem dlaczego ta funkcja zwraca mi null i 'object'.
Co możecie poradzić?