monsieurbiz / SyliusCmsPagePlugin

A Sylius plugin to manage your CMS pages
MIT License
37 stars 25 forks source link

CMS Plugin alongside SyliusAPI is leading to an error #28

Closed Hraph closed 2 years ago

Hraph commented 3 years ago

I have an issue with your plugin used alongside SyliusApi (ApiPlatform) features when executing an API request:

Attempted to call an undefined method named \"checkPageSlug\" of class \"Symfony\\Component\\Routing\\RequestContext\".

In an API endpoint, I use the URI format to refer to other business entities. When the URI format is used in the API, the router is called to evaluate the URI, and the route "monsieurbiz_cms_page_shop" which has a wildcard (/{slug}) is evaluated.

Unfortunately, in this Router instance, Symphony's RequestContext (Symfony\Component\Routing\RequestContext) is used and not the decorated RequestContext of MonsieurBiz (MonsieurBiz\SyliusCmsPagePlugin\Routing\RequestContext). You can see here that it is directly instantiated.

A solution might be to test the context type in the route condition. Thanks