Important

You are browsing documentation for version 6.0 of OroCommerce, supported until 2028. Read the documentation for the latest LTS version to get up-to-date information.

See our Release Process documentation for more information on the currently supported and upcoming releases.

Storefront Routes 

Storefront API has an API resource routes that returns information about the storefront URLs. This information includes a resource type and the relative URL of an API resource you can use to get the data.

Two types of resolvers are used to provide this information:

Register the resource type resolvers in the service container with the oro_frontend.api.resource_type_resolver tag. Optionally, use the routeName tag attribute to specify the route the resolver applies to.

Register the API URL resolvers in the service container with the oro_frontend.api.resource_api_url_resolver tag. Optionally, use the routeName tag attribute to specify the route the resolver applies to.

An example of resolvers registration in the services_api.yml file:

services:
    oro_cms.api.resource_type_resolver.landing_page:
        class: Oro\Bundle\FrontendBundle\Api\ResourceTypeResolver
        arguments:
            - 'landing_page' # the resource type should be returned for the route oro_cms_frontend_page_view
        tags:
            - { name: oro_frontend.api.resource_type_resolver, routeName: oro_cms_frontend_page_view }

    oro_cms.api.resource_api_url_resolver.landing_page:
        class: Oro\Bundle\FrontendBundle\Api\ResourceRestApiGetActionUrlResolver
        arguments:
            - '@router'
            - '@oro_api.rest.routes_registry'
            - '@oro_api.value_normalizer'
            - Oro\Bundle\CMSBundle\Entity\Page
        tags:
            - { name: oro_frontend.api.resource_api_url_resolver, routeName: oro_cms_frontend_page_view, requestType: rest }

Here are some useful implementations of ResourceTypeResolverInterface and ResourceApiUrlResolverInterface: