From 28fcdca977e5839270bbd24cf42b21d2589aec70 Mon Sep 17 00:00:00 2001 From: Taras Machyshyn Date: Mon, 5 Jan 2015 17:22:56 +0200 Subject: [PATCH] added custom loaders in metadata 'app' --- application/Espo/Core/Container.php | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/application/Espo/Core/Container.php b/application/Espo/Core/Container.php index b52b161e48..feb7f5db1c 100644 --- a/application/Espo/Core/Container.php +++ b/application/Espo/Core/Container.php @@ -51,9 +51,13 @@ class Container $obj = $this->$loadMethod(); $this->data[$name] = $obj; } else { - $className = '\Espo\Custom\Core\Loaders\\'.ucfirst($name); - if (!class_exists($className)) { - $className = '\Espo\Core\Loaders\\'.ucfirst($name); + + $className = $this->get('metadata')->get('app.loaders.' . ucfirst($name)); + if (!isset($className) || !class_exists($className)) { + $className = '\Espo\Custom\Core\Loaders\\'.ucfirst($name); + if (!class_exists($className)) { + $className = '\Espo\Core\Loaders\\'.ucfirst($name); + } } if (class_exists($className)) { @@ -64,7 +68,7 @@ class Container return null; } - + protected function getServiceClassName($name, $default) { $metadata = $this->get('metadata'); @@ -204,7 +208,7 @@ class Container $this->get('preferences') ); } - + private function loadCrypt() { return new \Espo\Core\Utils\Crypt(