ApiPlatform\Core\Bridge\Symfony\Routing\OperationMethodResolver::getOperationRoute PHP Method

getOperationRoute() private method

Gets the route related to the given operation.
private getOperationRoute ( string $resourceClass, string $operationName, boolean $collection ) : Symfony\Component\Routing\Route
$resourceClass string
$operationName string
$collection boolean
return Symfony\Component\Routing\Route
    private function getOperationRoute(string $resourceClass, string $operationName, bool $collection) : Route
    {
        $routeName = $this->getRouteName($this->resourceMetadataFactory->create($resourceClass), $operationName, $collection);
        if (null !== $routeName) {
            return $this->getRoute($routeName);
        }
        $operationNameKey = sprintf('_api_%s_operation_name', $collection ? 'collection' : 'item');
        foreach ($this->router->getRouteCollection()->all() as $routeName => $route) {
            $currentResourceClass = $route->getDefault('_api_resource_class');
            $currentOperationName = $route->getDefault($operationNameKey);
            if ($resourceClass === $currentResourceClass && $operationName === $currentOperationName) {
                return $route;
            }
        }
        throw new RuntimeException(sprintf('No route found for operation "%s" for type "%s".', $operationName, $resourceClass));
    }