From 806e2631aa09739a8fcae50c4221b5727f1396d3 Mon Sep 17 00:00:00 2001 From: Benjamin Perche Date: Tue, 29 Jul 2014 14:01:48 +0200 Subject: [PATCH] =?UTF-8?q?Fix=20exports=20and=20imports=20parsing=20=09mo?= =?UTF-8?q?difi=C3=A9:=20=20=20=20=20=20=20=20=20core/lib/Thelia/Core/Depe?= =?UTF-8?q?ndencyInjection/Loader/XmlFileLoader.php?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Loader/XmlFileLoader.php | 39 +++++++++++++++++-- 1 file changed, 35 insertions(+), 4 deletions(-) diff --git a/core/lib/Thelia/Core/DependencyInjection/Loader/XmlFileLoader.php b/core/lib/Thelia/Core/DependencyInjection/Loader/XmlFileLoader.php index 628288349..2ec7c2680 100644 --- a/core/lib/Thelia/Core/DependencyInjection/Loader/XmlFileLoader.php +++ b/core/lib/Thelia/Core/DependencyInjection/Loader/XmlFileLoader.php @@ -48,6 +48,7 @@ use Thelia\Model\Map\ImportTableMap; */ class XmlFileLoader extends FileLoader { + /** * Loads an XML file. * @@ -77,13 +78,43 @@ class XmlFileLoader extends FileLoader $this->parseDefinitions($xml, $path); - $this->parseExportCategories($xml); + $this->propelOnlyRun( + [$this, "parseExportCategories"], + $xml, + ExportCategoryTableMap::DATABASE_NAME + ); - $this->parseExports($xml); + $this->propelOnlyRun( + [$this, "parseExports"], + $xml, + ExportTableMap::DATABASE_NAME + ); - $this->parseImportCategories($xml); + $this->propelOnlyRun( + [$this, "parseExportCategories"], + $xml, + ImportCategoryTableMap::DATABASE_NAME + ); - $this->parseImports($xml); + $this->propelOnlyRun( + [$this, "parseExports"], + $xml, + ImportTableMap::DATABASE_NAME + ); + } + + public function propelOnlyRun(callable $method, $arg, $name) + { + $doRun = false; + + try { + Propel::getConnection($name); + $doRun = true; + } catch (\ErrorException $e) {} + + if ($doRun) { + call_user_func($method, $arg); + } } protected function parseCommands(SimpleXMLElement $xml)