Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

You can add your own filter, and your owns locators.

  • Loading branch information...
commit 288d7f784fbe0a722d3037c5b4f0d554be13cc04 1 parent f75276b
Stéphane PY authored
33 DependencyInjection/Compiler/AddFilterCompilerPass.php
View
@@ -0,0 +1,33 @@
+<?php
+
+namespace Spy\TimelineBundle\DependencyInjection\Compiler;
+
+use Symfony\Component\DependencyInjection\ContainerBuilder;
+use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
+
+/**
+ * AddFilterCompilerPass
+ *
+ * @uses CompilerPassInterface
+ * @author Stephane PY <py.stephane1@gmail.com>
+ */
+class AddFilterCompilerPass implements CompilerPassInterface
+{
+ /**
+ * {@inheritdoc}
+ */
+ public function process(ContainerBuilder $container)
+ {
+ $filterManager = $container->getDefinition('spy_timeline.filter.manager');
+
+ foreach ($container->findTaggedServiceIds('spy_timeline.filter') as $id => $tags) {
+ $filterManager->addMethodCall('add', array($container->getDefinition($id)));
+ }
+
+ $dataHydrator = $container->getDefinition('spy_timeline.filter.data_hydrator');
+
+ foreach ($container->findTaggedServiceIds('spy_timeline.filter.data_hydrator.locator') as $id => $tags) {
+ $dataHydrator->addMethodCall('addLocator', array($container->getDefinition($id)));
+ }
+ }
+}
2  README.md
View
@@ -6,8 +6,6 @@ SpyTimelineBundle 2.0
Roadmap before stable release:
==============================
-- Add your own filters
-- Twig (need review)
- Paginator #[37](https://github.com/stephpy/TimelineBundle/issues/37)
- Documentation
- Write tests with Atoum.
2  SpyTimelineBundle.php
View
@@ -5,6 +5,7 @@
use Symfony\Component\HttpKernel\Bundle\Bundle;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Spy\TimelineBundle\DependencyInjection\Compiler\AddSpreadCompilerPass;
+use Spy\TimelineBundle\DependencyInjection\Compiler\AddFilterCompilerPass;
/**
* SpyTimelineBundle
@@ -20,6 +21,7 @@ class SpyTimelineBundle extends Bundle
public function build(ContainerBuilder $container)
{
$container->addCompilerPass(new AddSpreadCompilerPass());
+ $container->addCompilerPass(new AddFilterCompilerPass());
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.