ModelBundle/Repository/RouteDocumentRepository.php
public function findByPathInfo($pathInfo)
    {
        $workingPattern = explode('/', trim($pathInfo, '/'));

        $qa = $this->createAggregationQuery('r');

        $filter = array();
        $i = 0;
        while ($i <= 10) {
            if (array_key_exists($i, $workingPattern)) {
                $filter['token' . $i] = new \MongoRegex('/^' . $workingPattern[$i] . '$|\*/');
            } else {
                $filter['token' . $i] = null;
            }
            $i++;
        }

        $qa->match($filter);
        $qa->sort(array('weight' => 1));

        return $this->hydrateAggregateQuery($qa);
    }
public function findByPathInfo($pathInfo)
    {
        $workingPattern = explode('/', trim($pathInfo, '/'));

        $qa = $this->createAggregationQuery('r');

        $filter = array();
        $i = 0;
        while ($i <= 10) {
            if (array_key_exists($i, $workingPattern)) {
                $filter['token' . $i] = new \MongoRegex('/^' . $workingPattern[$i] . '$|\*/');
            } else {
                $filter['token' . $i] = null;
            }
            $i++;
        }

        $qa->match($filter);
        $qa->sort(array('weight' => 1));

        return $this->hydrateAggregateQuery($qa);
    }
@param string $pathInfo

@return Collection