From 4b3c983ab85af2ab09540c4849a9e65843a7ab67 Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Sun, 30 Oct 2016 20:27:41 +0100 Subject: Inject parameter instead of service We are injecting CraueConfig service when we only need to retrieve one or two values from it. Instead I discovered we can directly inject a value from a service in the service definition! --- src/Wallabag/CoreBundle/Helper/EntriesExport.php | 7 +++---- src/Wallabag/CoreBundle/Resources/config/services.yml | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) (limited to 'src/Wallabag/CoreBundle') diff --git a/src/Wallabag/CoreBundle/Helper/EntriesExport.php b/src/Wallabag/CoreBundle/Helper/EntriesExport.php index e50c68a6..4bf292a4 100644 --- a/src/Wallabag/CoreBundle/Helper/EntriesExport.php +++ b/src/Wallabag/CoreBundle/Helper/EntriesExport.php @@ -8,7 +8,6 @@ use JMS\Serializer\SerializerBuilder; use PHPePub\Core\EPub; use PHPePub\Core\Structure\OPF\DublinCore; use Symfony\Component\HttpFoundation\Response; -use Craue\ConfigBundle\Util\Config; /** * This class doesn't have unit test BUT it's fully covered by a functional test with ExportControllerTest. @@ -27,12 +26,12 @@ class EntriesExport '; /** - * @param Config $craueConfig CraueConfig instance to get wallabag instance url from database + * @param string $wallabagUrl Wallabag instance url * @param string $logoPath Path to the logo FROM THE BUNDLE SCOPE */ - public function __construct(Config $craueConfig, $logoPath) + public function __construct($wallabagUrl, $logoPath) { - $this->wallabagUrl = $craueConfig->get('wallabag_url'); + $this->wallabagUrl = $wallabagUrl; $this->logoPath = $logoPath; } diff --git a/src/Wallabag/CoreBundle/Resources/config/services.yml b/src/Wallabag/CoreBundle/Resources/config/services.yml index 614488a6..b7b1b61b 100644 --- a/src/Wallabag/CoreBundle/Resources/config/services.yml +++ b/src/Wallabag/CoreBundle/Resources/config/services.yml @@ -91,7 +91,7 @@ services: wallabag_core.helper.entries_export: class: Wallabag\CoreBundle\Helper\EntriesExport arguments: - - "@craue_config" + - '@=service(''craue_config'').get(''wallabag_url'')' - src/Wallabag/CoreBundle/Resources/public/themes/_global/img/appicon/apple-touch-icon-152.png wallabag.operator.array.matches: -- cgit v1.2.3