Skip to content
This repository has been archived by the owner on Sep 16, 2021. It is now read-only.

Commit

Permalink
adjust to phpcr-odm event refactoring and improve docblocks
Browse files Browse the repository at this point in the history
  • Loading branch information
dbu committed May 28, 2013
1 parent 679aeb0 commit 13299e9
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions EventListener/AutoRouteListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@

namespace Symfony\Cmf\Bundle\RoutingAutoBundle\EventListener;

use Doctrine\ODM\PHPCR\Event\OnFlushEventArgs;
use Doctrine\Common\Persistence\Event\ManagerEventArgs;
use Doctrine\ODM\PHPCR\DocumentManager;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Cmf\Bundle\RoutingAutoBundle\Document\AutoRoute;
use Symfony\Cmf\Bundle\RoutingAutoBundle\AutoRoute\AutoRouteManager;

/**
* Doctrine PHPCR ODM listener for maintaining automatic routes.
Expand All @@ -18,16 +20,20 @@ public function __construct(ContainerInterface $container)
$this->container = $container;
}

/**
* @return AutoRouteManager
*/
protected function getArm()
{
// lazy load the auto_route_manager service to prevent a cirular-reference
// to the document manager.
return $this->container->get('cmf_routing_auto.auto_route_manager');
}

public function onFlush(OnFlushEventArgs $args)
public function onFlush(ManagerEventArgs $args)
{
$dm = $args->getDocumentManager();
/** @var $dm DocumentManager */
$dm = $args->getObjectManager();
$uow = $dm->getUnitOfWork();

$scheduledInserts = $uow->getScheduledInserts();
Expand Down

0 comments on commit 13299e9

Please sign in to comment.