diff --git a/application/Espo/Controllers/GlobalSearch.php b/application/Espo/Controllers/GlobalSearch.php index 8327b3a6c0..6f9396eea1 100644 --- a/application/Espo/Controllers/GlobalSearch.php +++ b/application/Espo/Controllers/GlobalSearch.php @@ -29,8 +29,17 @@ namespace Espo\Controllers; -class GlobalSearch extends \Espo\Core\Controllers\Base +use Espo\Core\ServiceFactory; + +class GlobalSearch { + protected $serviceFactory; + + public function __construct(ServiceFactory $serviceFactory) + { + $this->serviceFactory = $serviceFactory; + } + public function actionSearch($params, $data, $request) { $query = $request->get('q'); @@ -38,6 +47,6 @@ class GlobalSearch extends \Espo\Core\Controllers\Base $offset = intval($request->get('offset')); $maxSize = intval($request->get('maxSize')); - return $this->getService('GlobalSearch')->find($query, $offset, $maxSize); + return $this->serviceFactory->create('GlobalSearch')->find($query, $offset, $maxSize); } } diff --git a/application/Espo/Controllers/I18n.php b/application/Espo/Controllers/I18n.php index 0a124ef0a0..da614c2abe 100644 --- a/application/Espo/Controllers/I18n.php +++ b/application/Espo/Controllers/I18n.php @@ -29,12 +29,21 @@ namespace Espo\Controllers; -class I18n extends \Espo\Core\Controllers\Base +use Espo\Core\ServiceFactory; + +class I18n { + protected $serviceFactory; + + public function __construct(ServiceFactory $serviceFactory) + { + $this->serviceFactory = $serviceFactory; + } + public function actionRead($params, $data, $request) { $default = $request->get('default') === 'true'; - return $this->getServiceFactory()->create('Language')->getDataForFrontend($default); + return $this->serviceFactory->create('Language')->getDataForFrontend($default); } }