diff --git a/app/code/community/Inviqa/SymfonyContainer/Model/Observer.php b/app/code/community/Inviqa/SymfonyContainer/Model/Observer.php
index 7b13fde..5d5e8b3 100644
--- a/app/code/community/Inviqa/SymfonyContainer/Model/Observer.php
+++ b/app/code/community/Inviqa/SymfonyContainer/Model/Observer.php
@@ -12,19 +12,16 @@ class Inviqa_SymfonyContainer_Model_Observer
public function onCacheRefresh(Varien_Event_Observer $event)
{
- if (ConfigurationBuilder::MODEL_ALIAS === $event->getType()) {
- $containerFilePath = $this->containerCachePath();
- $metaFilePath = $this->containerCacheMetaPath();
-
- if (file_exists($containerFilePath)) {
- unlink($containerFilePath);
- }
-
- if (file_exists($metaFilePath)) {
- unlink($metaFilePath);
- }
+ if ($event->getType() === ConfigurationBuilder::MODEL_ALIAS) {
+ $this->clearCache();
}
}
+
+ public function onCacheFlush()
+ {
+ $this->clearCache();
+ }
+
public function onPreDispatch(Varien_Event_Observer $event)
{
$controller = $event->getControllerAction();
@@ -34,6 +31,20 @@ public function onPreDispatch(Varien_Event_Observer $event)
])->setupDependencies($controller);
}
+ private function clearCache()
+ {
+ $containerFilePath = $this->containerCachePath();
+ $metaFilePath = $this->containerCacheMetaPath();
+
+ if (file_exists($containerFilePath)) {
+ unlink($containerFilePath);
+ }
+
+ if (file_exists($metaFilePath)) {
+ unlink($metaFilePath);
+ }
+ }
+
private function containerCachePath()
{
return Mage::getBaseDir('cache') . DIRECTORY_SEPARATOR . ConfigurationBuilder::CACHED_CONTAINER;
diff --git a/app/code/community/Inviqa/SymfonyContainer/etc/config.xml b/app/code/community/Inviqa/SymfonyContainer/etc/config.xml
index 35c408d..f23cb53 100644
--- a/app/code/community/Inviqa/SymfonyContainer/etc/config.xml
+++ b/app/code/community/Inviqa/SymfonyContainer/etc/config.xml
@@ -22,6 +22,24 @@
+
+
+
+ Inviqa_SymfonyContainer_Model_Observer
+ singleton
+ onCacheFlush
+
+
+
+
+
+
+ Inviqa_SymfonyContainer_Model_Observer
+ singleton
+ onCacheFlush
+
+
+
@@ -43,4 +61,4 @@
-
\ No newline at end of file
+