aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag/ImportBundle/Import/ImportCompilerPass.php
diff options
context:
space:
mode:
authorJeremy Benoist <jeremy.benoist@gmail.com>2015-12-31 11:24:46 +0100
committerJeremy Benoist <jeremy.benoist@gmail.com>2016-01-02 23:27:41 +0100
commit7019c7cf6c6af39c0f458769e20c3f9306477943 (patch)
tree12acceaa458cdf6d24367eba85f690265acddcdb /src/Wallabag/ImportBundle/Import/ImportCompilerPass.php
parentb1d05721cf37ab94ec1a6837fe79cf19474dd0ff (diff)
downloadwallabag-7019c7cf6c6af39c0f458769e20c3f9306477943.tar.gz
wallabag-7019c7cf6c6af39c0f458769e20c3f9306477943.tar.zst
wallabag-7019c7cf6c6af39c0f458769e20c3f9306477943.zip
Add tagged services for import
- list services in /import - add url to import service - ImportBundle routing are now prefixed by /import - optimize flush in each import (flushing each 20 contents) - improve design of each import - add more tests
Diffstat (limited to 'src/Wallabag/ImportBundle/Import/ImportCompilerPass.php')
-rw-r--r--src/Wallabag/ImportBundle/Import/ImportCompilerPass.php33
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
3namespace Wallabag\ImportBundle\Import;
4
5use Symfony\Component\DependencyInjection\ContainerBuilder;
6use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
7use Symfony\Component\DependencyInjection\Reference;
8
9class 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}