Permalink
Browse files

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

  • Loading branch information...
1 parent f75276b commit 288d7f784fbe0a722d3037c5b4f0d554be13cc04 @stephpy committed Dec 2, 2012
Showing with 35 additions and 2 deletions.
  1. +33 −0 DependencyInjection/Compiler/AddFilterCompilerPass.php
  2. +0 −2 README.md
  3. +2 −0 SpyTimelineBundle.php
@@ -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)));
+ }
+ }
+}
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.
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());
}
}

0 comments on commit 288d7f7

Please sign in to comment.