end module activation

This commit is contained in:
Manuel Raynaud
2013-10-18 10:06:42 +02:00
parent 52ed89f1aa
commit e602884ce0
3 changed files with 8 additions and 8 deletions

View File

@@ -53,9 +53,7 @@ class Module extends BaseAction implements EventSubscriberInterface
} }
} }
if ($module->isModified()) { $event->setModule($module);
$event->setModule($module);
}
$this->cacheClear(); $this->cacheClear();
} }

View File

@@ -135,17 +135,19 @@ abstract class BaseModule extends ContainerAware
} }
} }
public function deployImageFolder(Module $module, $folderPath) public function deployImageFolder(Module $module, $folderPath, ConnectionInterface $con = null)
{ {
try { try {
$directoryBrowser = new \DirectoryIterator($folderPath); $directoryBrowser = new \DirectoryIterator($folderPath);
} catch (\UnexpectedValueException $e) { } catch (\UnexpectedValueException $e) {
throw $e; throw $e;
} }
if(null === $con) {
$con = \Propel\Runtime\Propel::getConnection(
ModuleImageTableMap::DATABASE_NAME
);
}
$con = \Propel\Runtime\Propel::getConnection(
ModuleImageTableMap::DATABASE_NAME
);
/* browse the directory */ /* browse the directory */
$imagePosition = 1; $imagePosition = 1;

View File

@@ -66,7 +66,7 @@ class Cheque extends BaseModule implements PaymentModuleInterface
/* insert the images from image folder if first module activation */ /* insert the images from image folder if first module activation */
$module = $this->getModuleModel(); $module = $this->getModuleModel();
if(ModuleImageQuery::create()->filterByModule($module)->count() == 0) { if(ModuleImageQuery::create()->filterByModule($module)->count() == 0) {
$this->deployImageFolder($module, sprintf('%s/images', __DIR__)); $this->deployImageFolder($module, sprintf('%s/images', __DIR__), $con);
} }
/* set module title */ /* set module title */