Hi there.
I trie to implement a "removeCache" method in my "Ad" model class. As
the method is called within backend and within frontend, I have to
retrieve the right context.
Cached components stand in the frontend, so I though I could to this
(in Ad propel's model class) :
public function removeCache()
{
$configuration = ProjectConfiguration::getApplicationConfiguration
('frontend', sfContext::getInstance()->getConfiguration()-
>getEnvironment(), false);
$context = sfContext::createInstance($configuration);
$caheManager = $context->getViewCacheManager();
$caheManager->remove('@sf_cache_partial?
module=ad&action=_listItemPublic&sf_cache_key='.$this->getId());
$caheManager->remove('@sf_cache_partial?
module=ad&action=_listItemPrivate&sf_cache_key='.$this->getId());
$caheManager->remove('@sf_cache_partial?
module=ad&action=_listItemDraft&sf_cache_key='.$this->getId());
}
Of course (I'm here for that) it don't work ... bu why ?
If I trace $context within backend, I get the right context (frontend/
dev). But the cache manager doesn't find the cache files !! If I do
the same in the frontend (actually just the 4 last lines of the
function), it works well.
Please, help needed ! Has anyone the same problem ? Maybe is it bad to
implement such a method in the model ? Must I create a task for that ?
I will surely get the same problem isn't it ?
Thanks for reading !
JF
--~--~---------~--~----~------------~-------~--~----~
Vous avez reçu ce message, car vous êtes abonné au groupe Groupe "Symfony-fr"
de Google Groupes.
Pour transmettre des messages à ce groupe, envoyez un e-mail à
l'adresse [email protected]
Pour résilier votre abonnement à ce groupe, envoyez un e-mail à
l'adresse [email protected]
Pour afficher d'autres options, visitez ce groupe à l'adresse
http://groups.google.com/group/symfony-fr?hl=fr
-~----------~----~----~----~------~----~------~--~---