Permalink
Browse files

added cache-invalidator-listener service (just the setup)

  • Loading branch information...
1 parent 685e696 commit ae83b43e6f0c780aba7e95801efaff0082008409 Reto Ryter committed Mar 8, 2013
Showing with 50 additions and 4 deletions.
  1. +30 −0 EventListener/ImageCacheInvalidatorListener.php
  2. +0 −4 Resources/config/odm.xml
  3. +20 −0 Resources/config/odm_image.xml
@@ -0,0 +1,30 @@
+<?php
+
+namespace Doctrine\Bundle\PHPCRBundle\EventListener;
+
+use Doctrine\Common\Util\Debug;
+use Doctrine\ODM\PHPCR\Event\LifecycleEventArgs;
+use Liip\ImagineBundle\Imagine\Data\Loader\DoctrinePHPCRLoader;
+use Symfony\Component\EventDispatcher\EventSubscriberInterface;
+use Symfony\Component\HttpKernel\KernelEvents;
+
+/**
+ * A listener to tell the locale chooser the request locale.
+ *
+ * This listener is invoked on every sub-request, keeping the locale up to date.
+ */
+class ImageCacheInvalidatorListener
+{
+
+ protected $phpcrLoader;
+
+ public function __construct(DoctrinePHPCRLoader $phpcrLoader)
+ {
+
+ }
+ public function postUpdate(LifecycleEventArgs $args)
+ {
+
+ }
+
+}
View
@@ -60,10 +60,6 @@
<argument type="service" id="service_container"/>
</service>
- <service id="form.type.phpcr_odm.image" class="Doctrine\Bundle\PHPCRBundle\Form\Type\ImageType">
- <tag name="form.type" alias="phpcr_odm_image"/>
- </service>
-
<service id="form.type.phpcr_odm.reference_collection" class="Doctrine\Bundle\PHPCRBundle\Form\Type\PHPCRODMReferenceCollectionType">
<tag name="form.type" alias="phpcr_odm_reference_collection"/>
<argument type="service" id="doctrine_phpcr.odm.document_manager"/>
@@ -0,0 +1,20 @@
+<?xml version="1.0" ?>
+
+<container xmlns="http://symfony.com/schema/dic/services"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
+
+ <services>
+
+ <service id="form.type.phpcr_odm.image" class="Doctrine\Bundle\PHPCRBundle\Form\Type\ImageType">
+ <tag name="form.type" alias="phpcr_odm_image"/>
+ </service>
+
+ <service id="doctrine_phpcr.odm.listener.image_cache" class="Doctrine\Bundle\PHPCRBundle\EventListener\ImageCacheInvalidatorListener">
+ <tag name="doctrine_phpcr.event_listener" event="postUpdate" />
+ <argument type="service" id="liipch_core.imagine.data_loader.phpcr"/>
+ </service>
+
+ </services>
+
+</container>

0 comments on commit ae83b43

Please sign in to comment.