/** * Clear the doctrine context if the internal iterator buffer is empty. * * @param IterateEvent $event */ public function iterate(IterateEvent $event) { foreach ($this->doctrine->getManagers() as $name => $manager) { if (!$manager->isOpen()) { throw new \RuntimeException(sprintf('The doctrine manager: %s is closed', $name)); } $manager->getUnitOfWork()->clear(); } }
public function __construct(Container $container, Registry $doctrine, Router $router, $root, array $staticRoutes, $host = "localhost") { $this->container = $container; $this->managers = $doctrine->getManagers(); $this->reader = new AnnotationReader(); $this->router = $router; $this->staticRoutes = $staticRoutes; $this->router->getContext()->setHost($host); $root = explode("/app", $root, 2); $this->root = array_shift($root) . "/web/sitemap.xml"; }