diff options
author | Jeremy Benoist <jeremy.benoist@gmail.com> | 2016-10-30 20:27:41 +0100 |
---|---|---|
committer | Jeremy Benoist <jeremy.benoist@gmail.com> | 2016-10-30 20:27:41 +0100 |
commit | 4b3c983ab85af2ab09540c4849a9e65843a7ab67 (patch) | |
tree | 83fcdb3959cdd8735fee1f4d7520bf8db8709131 /src/Wallabag/CoreBundle | |
parent | f74061f1e1e70f8f1ec1fb72f7cf6e1ed388023c (diff) | |
download | wallabag-4b3c983ab85af2ab09540c4849a9e65843a7ab67.tar.gz wallabag-4b3c983ab85af2ab09540c4849a9e65843a7ab67.tar.zst wallabag-4b3c983ab85af2ab09540c4849a9e65843a7ab67.zip |
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!
Diffstat (limited to 'src/Wallabag/CoreBundle')
-rw-r--r-- | src/Wallabag/CoreBundle/Helper/EntriesExport.php | 7 | ||||
-rw-r--r-- | src/Wallabag/CoreBundle/Resources/config/services.yml | 2 |
2 files changed, 4 insertions, 5 deletions
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; | |||
8 | use PHPePub\Core\EPub; | 8 | use PHPePub\Core\EPub; |
9 | use PHPePub\Core\Structure\OPF\DublinCore; | 9 | use PHPePub\Core\Structure\OPF\DublinCore; |
10 | use Symfony\Component\HttpFoundation\Response; | 10 | use Symfony\Component\HttpFoundation\Response; |
11 | use Craue\ConfigBundle\Util\Config; | ||
12 | 11 | ||
13 | /** | 12 | /** |
14 | * This class doesn't have unit test BUT it's fully covered by a functional test with ExportControllerTest. | 13 | * This class doesn't have unit test BUT it's fully covered by a functional test with ExportControllerTest. |
@@ -27,12 +26,12 @@ class EntriesExport | |||
27 | </div>'; | 26 | </div>'; |
28 | 27 | ||
29 | /** | 28 | /** |
30 | * @param Config $craueConfig CraueConfig instance to get wallabag instance url from database | 29 | * @param string $wallabagUrl Wallabag instance url |
31 | * @param string $logoPath Path to the logo FROM THE BUNDLE SCOPE | 30 | * @param string $logoPath Path to the logo FROM THE BUNDLE SCOPE |
32 | */ | 31 | */ |
33 | public function __construct(Config $craueConfig, $logoPath) | 32 | public function __construct($wallabagUrl, $logoPath) |
34 | { | 33 | { |
35 | $this->wallabagUrl = $craueConfig->get('wallabag_url'); | 34 | $this->wallabagUrl = $wallabagUrl; |
36 | $this->logoPath = $logoPath; | 35 | $this->logoPath = $logoPath; |
37 | } | 36 | } |
38 | 37 | ||
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: | |||
91 | wallabag_core.helper.entries_export: | 91 | wallabag_core.helper.entries_export: |
92 | class: Wallabag\CoreBundle\Helper\EntriesExport | 92 | class: Wallabag\CoreBundle\Helper\EntriesExport |
93 | arguments: | 93 | arguments: |
94 | - "@craue_config" | 94 | - '@=service(''craue_config'').get(''wallabag_url'')' |
95 | - src/Wallabag/CoreBundle/Resources/public/themes/_global/img/appicon/apple-touch-icon-152.png | 95 | - src/Wallabag/CoreBundle/Resources/public/themes/_global/img/appicon/apple-touch-icon-152.png |
96 | 96 | ||
97 | wallabag.operator.array.matches: | 97 | wallabag.operator.array.matches: |