src/Graviton/DocumentBundle/Service/ExtReferenceConverter.php
private function getDataFromRoute(Route $route, $value)
    {
        if ($route->getRequirement('id') !== null &&
            $route->getMethods() === ['GET'] &&
            preg_match($route->compile()->getRegex(), $value, $matches)
        ) {
            $id = $matches['id'];

            list($routeService) = explode(':', $route->getDefault('_controller'));
            list($core, $bundle,,$name) = explode('.', $routeService);
            $serviceName = implode('.', [$core, $bundle, 'rest', $name]);
            $collection = array_search($serviceName, $this->mapping);

            return [$collection, $id];
        }

        return [null, null];
    }
private function getDataFromRoute(Route $route, $value)
    {
        if ($route->getRequirement('id') !== null &&
            $route->getMethods() === ['GET'] &&
            preg_match($route->compile()->getRegex(), $value, $matches)
        ) {
            $id = $matches['id'];

            list($routeService) = explode(':', $route->getDefault('_controller'));
            list($core, $bundle,,$name) = explode('.', $routeService);
            $serviceName = implode('.', [$core, $bundle, 'rest', $name]);
            $collection = array_search($serviceName, $this->mapping);

            return [$collection, $id];
        }

        return [null, null];
    }
private function getDataFromRoute ( Route $ route , $ value ) { if ( $ route -> getRequirement ( 'id' ) !== null && $ route -> getMethods ( ) === [ 'GET' ] && preg_match ( $ route -> compile ( ) -> getRegex ( ) , $ value , $ matches ) ) { $ id = $ matches [ 'id' ] ; list ( $ routeService ) = explode ( ':' , $ route -> getDefault ( '_controller' ) ) ; list ( $ core , $ bundle , , $ name ) = explode ( '.' , $ routeService ) ; $ serviceName = implode ( '.' , [ $ core , $ bundle , 'rest' , $ name ] ) ; $ collection = array_search ( $ serviceName , $ this -> mapping ) ; return [ $ collection , $ id ] ; } return [ null , null ] ; }
get collection and id from route

@param Route  $route route to look at
@param string $value value of reference as URI

@return array
get collection and id from route