Check if modules could be instantiated

This commit is contained in:
Franck Allimant
2014-04-26 16:01:22 +02:00
parent d8c2f35446
commit addbd9a84c

View File

@@ -168,8 +168,21 @@ class Module extends BaseI18nLoop implements PropelSearchLoopInterface
{ {
/** @var \Thelia\Model\Module $module */ /** @var \Thelia\Model\Module $module */
foreach ($loopResult->getResultDataCollection() as $module) { foreach ($loopResult->getResultDataCollection() as $module) {
try {
new \ReflectionClass($module->getFullNamespace());
$exists = true;
}
catch(\ReflectionException $ex) {
$exists = false;
}
if ($exists || $this->getBackendContext()) {
$loopResultRow = new LoopResultRow($module); $loopResultRow = new LoopResultRow($module);
$loopResultRow->set("ID", $module->getId())
$loopResultRow
->set("ID" , $module->getId())
->set("IS_TRANSLATED", $module->getVirtualColumn('IS_TRANSLATED')) ->set("IS_TRANSLATED", $module->getVirtualColumn('IS_TRANSLATED'))
->set("LOCALE" , $this->locale) ->set("LOCALE" , $this->locale)
->set("TITLE" , $module->getVirtualColumn('i18n_TITLE')) ->set("TITLE" , $module->getVirtualColumn('i18n_TITLE'))
@@ -180,7 +193,9 @@ class Module extends BaseI18nLoop implements PropelSearchLoopInterface
->set("TYPE" , $module->getType()) ->set("TYPE" , $module->getType())
->set("ACTIVE" , $module->getActivate()) ->set("ACTIVE" , $module->getActivate())
->set("CLASS" , $module->getFullNamespace()) ->set("CLASS" , $module->getFullNamespace())
->set("POSITION", $module->getPosition()); ->set("POSITION" , $module->getPosition())
->set("EXISTS" , $exists)
;
$hasConfigurationInterface = false; $hasConfigurationInterface = false;
@@ -227,6 +242,7 @@ class Module extends BaseI18nLoop implements PropelSearchLoopInterface
$loopResult->addRow($loopResultRow); $loopResult->addRow($loopResultRow);
} }
}
return $loopResult; return $loopResult;