public function getRouteCollectionForRequest(Request $request)
    {
        $collection = new RouteCollection();

        // Fetch pages IDs by request path.
        $qb = $this->pageRepository->createQueryBuilder('p');
        $qb
            ->select('p.id')
            ->join('p.translations', 't')
            ->andWhere($qb->expr()->eq('p.static', 0))
            ->andWhere($qb->expr()->eq('t.path', $qb->expr()->literal(rawurldecode($request->getPathInfo()))))
        ;
        $results = $qb
            ->getQuery()
            ->getArrayResult()
        ;
        if (empty($results)) {
            return $collection;
        }

        $ids = array_unique(array_map(function($row) {
            return $row['id'];
        }, $results));

        // Fetch pages by IDs
        $qb = $this->pageRepository->createQueryBuilder('p');
        $results = $qb
            ->select('p.route, p.controller, t.path, t.locale')
            ->join('p.translations', 't')
            ->andWhere($qb->expr()->eq('p.static', 0))
            ->andWhere($qb->expr()->in('p.id', $ids))
            ->getQuery()
            ->getArrayResult()
        ;

        $routes =  $this->transformResultsToRoutes($results);

        // Build collection
        foreach ($routes as $name => $route) {
            $collection->add($name, $route);
        }

        return $collection;
    }