diff options
author | Jeremy Benoist <j0k3r@users.noreply.github.com> | 2016-01-07 22:15:08 +0100 |
---|---|---|
committer | Jeremy Benoist <j0k3r@users.noreply.github.com> | 2016-01-07 22:15:08 +0100 |
commit | 39643c6b76d92d509b1af0228b6379d7fdce8a1c (patch) | |
tree | 931dceef7dbc8ae9911d01ded709d558417a6cdd /src/Wallabag/ImportBundle/Import/ImportCompilerPass.php | |
parent | 488a468e3e11ff0ab6284afe232bf0f7fa68a8eb (diff) | |
parent | b88cf91fc8371194df78e690983c61ea94f266cd (diff) | |
download | wallabag-39643c6b76d92d509b1af0228b6379d7fdce8a1c.tar.gz wallabag-39643c6b76d92d509b1af0228b6379d7fdce8a1c.tar.zst wallabag-39643c6b76d92d509b1af0228b6379d7fdce8a1c.zip |
Merge pull request #1493 from wallabag/v2-pocket-import2.0.0-alpha.1
v2 – 1st draft for Pocket import via API & Wallabag v1 import
Diffstat (limited to 'src/Wallabag/ImportBundle/Import/ImportCompilerPass.php')
-rw-r--r-- | src/Wallabag/ImportBundle/Import/ImportCompilerPass.php | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/src/Wallabag/ImportBundle/Import/ImportCompilerPass.php b/src/Wallabag/ImportBundle/Import/ImportCompilerPass.php new file mode 100644 index 00000000..a363a566 --- /dev/null +++ b/src/Wallabag/ImportBundle/Import/ImportCompilerPass.php | |||
@@ -0,0 +1,33 @@ | |||
1 | <?php | ||
2 | |||
3 | namespace Wallabag\ImportBundle\Import; | ||
4 | |||
5 | use Symfony\Component\DependencyInjection\ContainerBuilder; | ||
6 | use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; | ||
7 | use Symfony\Component\DependencyInjection\Reference; | ||
8 | |||
9 | class ImportCompilerPass implements CompilerPassInterface | ||
10 | { | ||
11 | public function process(ContainerBuilder $container) | ||
12 | { | ||
13 | if (!$container->hasDefinition('wallabag_import.chain')) { | ||
14 | return; | ||
15 | } | ||
16 | |||
17 | $definition = $container->getDefinition( | ||
18 | 'wallabag_import.chain' | ||
19 | ); | ||
20 | |||
21 | $taggedServices = $container->findTaggedServiceIds( | ||
22 | 'wallabag_import.import' | ||
23 | ); | ||
24 | foreach ($taggedServices as $id => $tagAttributes) { | ||
25 | foreach ($tagAttributes as $attributes) { | ||
26 | $definition->addMethodCall( | ||
27 | 'addImport', | ||
28 | [new Reference($id), $attributes['alias']] | ||
29 | ); | ||
30 | } | ||
31 | } | ||
32 | } | ||
33 | } | ||