[DC-770] Result Cache Created: 29/Jun/10  Updated: 29/Jun/10

Status: Open
Project: Doctrine 1
Component/s: Record
Affects Version/s: 1.2.2
Fix Version/s: None

Type: Bug Priority: Blocker
Reporter: Thomas Tourlourat - Armetiz Assignee: Jonathan H. Wage
Resolution: Unresolved Votes: 0
Labels: None


Doctrine result cache isn't working properly.

Here a simple example, when I'm calling query->execute (); parentProgram is related to a video.
Into the Doctrine_Query_Abstract.php file

line 1014 : I have just add some code to output data.
if ($cached === false)

{ // cache miss $stmt = $this->_execute($params); $this->_hydrator->setQueryComponents($this->_queryComponents); $result = $this->_hydrator->hydrateResultSet($stmt, $this->_tableAliasMap); $oVideo = $result[0]; echo "not cached "; var_dump (count ($oVideo->parentProgram->getReferences ())); $cached = $this->getCachedForm($result); $cacheDriver->save($hash, $cached, $this->getResultCacheLifeSpan()); }


{ $result = $this->_constructQueryFromCache($cached); $oVideo = $result[0]; echo "cached "; var_dump (count ($oVideo->parentProgram->getReferences ())); exit (0); }


The output of a query execution (the first with an empty APC cache) with "useResultCache" is :

  • not cached int(1)
  • cached int(0)

The problem is coming from the serialize php function that can't serialize protected properties..
getReferences is a getter to a protected property.. So data result can't work properly.

A solution could be use __sleep function, and a public property that contain all important protected data.

Generated at Wed Nov 25 09:27:32 EST 2015 using JIRA 6.4.10#64025-sha1:5b8b74079161cd76a20ab66dda52747ee6701bd6.