#1630: Using ATTR_QUERY_CACHE prevents Record_Filter to be called
-----------------------------------+----------------------------------------
Reporter: cedsadai | Owner: romanb
Type: defect | Status: new
Priority: critical | Milestone: Unknown
Component: Record | Version: 1.0.3
Keywords: filter, query_cache | Has_test: 0
Mystatus: Pending Core Response | Has_patch: 0
-----------------------------------+----------------------------------------
Env: Mac OS X v10.5, PHP 5.2.5 (Mamp)
Framework: symfony 1.1
Branch used: 1.1
When one activates the QUERY_CACHE attribute onto the manager or the
connection, the Record_Filter isn't called anymore.
Filter that activates QUERY_CACHE
{{{
class dbcacheFilter extends sfFilter
{
public function execute($filterChain)
{
if ($this->isFirstCall())
{
$connexion =
Doctrine_Manager::getInstance()->getCurrentConnection();
$servers = array('host' => '127.0.0.1',
'port' => 11211,
'persistent' => true);
$cacheDriver = new
Doctrine_Cache_Memcache(array('servers' => $servers,
'compression' => false));
$connexion->setAttribute(Doctrine::ATTR_QUERY_CACHE, $cacheDriver);
}
$filterChain->execute();
}
}
}}}
Gives an error each time you want to access / set a Translation-ized
table.
Exception thrown: [Doctrine_Collection_Exception]
'''Couldn't create collection index. Record field 'lang' was null.'''
To debug the problem, I did some echo() in sfRecordI18nFilter (where the
i18n is handled), like this:
{{{
class sfDoctrineRecordI18nFilter extends Doctrine_Record_Filter
{
public function init()
{
}
public function filterSet(Doctrine_Record $record, $name, $value)
{
echo sfDoctrineRecord::getDefaultCulture().'---';
return
$record['Translation'][sfDoctrineRecord::getDefaultCulture()][$name] =
$value;
}
public function filterGet(Doctrine_Record $record, $name)
{
echo 'cool';
echo sfDoctrineRecord::getDefaultCulture().'---';
return
$record['Translation'][sfDoctrineRecord::getDefaultCulture()][$name];
}
}
}}}
but nothing is displayed.
I just have to comment the line
"$connexion->setAttribute(Doctrine::ATTR_QUERY_CACHE, $cacheDriver);" in
my filter, for everything to work perfectly again.
Would that be possible to implement the changes done in 1.2 branch on
sfDoctrineDatabase so we can activate attributes in the schema.yml? Maybe
this cleaner implementation would solve the thing.
Note: there is no such thing with Doctrine::ATTR_RESULT_CACHE
--
Ticket URL: <http://trac.doctrine-project.org/ticket/1630>
Doctrine <http://www.phpdoctrine.org>
PHP Doctrine Object Relational Mapper
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"doctrine-svn" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.co.uk/group/doctrine-svn?hl=en-GB
-~----------~----~----~----~------~----~------~--~---