Details
-
Bug
-
Resolution: Unresolved
-
Medium
-
None
-
4.1.2
-
None
-
- Debian 10
- Apache 2.4.38
- PHP 7.4.29
- Ibexa DXP 4.1.2 Experience
Description
Hi,
While revising Extending the REST API route parts during IBX-1430, I encountered a problem when I tried to automatically add the OPTIONS method to custom routes using the OptionsLoader like config/routes/ibexa_rest.yaml does: The path to the custom REST routes' file has to be absolute…
In the following, the DXP is installed in /var/www/, and, the custom REST routes are declared in /var/www/config/routes_rest.yaml which is imported from /var/www/config/routes.yaml.
#config/routes.yaml app.rest: resource: routes_rest.yaml prefix: '%ibexa.rest.path_prefix%' app.rest.options: #resource: routes_rest.yaml resource: '/var/www/config/routes_rest.yaml' #resource: '%kernel.project_dir%/config/routes_rest.yaml' prefix: '%ibexa.rest.path_prefix%' type: rest_options
- While resource: routes_rest.yaml works well for the standard import, it doesn't work with the OptionsLoader, the following error is thrown while clearing the cache: The file "routes_rest.yaml" does not exist (in: "") in routes_rest.yaml (which is being imported from "/var/www/config/routes/ibexa_rest.yaml"). Make sure there is a loader supporting the "rest_options" type.
- The absolute path make the import works as expected, the options routes corresponding to the custom routes are created and functional.
- The attempt to use kernel.project_dir parameter to have a more generic workaround leads to the previous error: The file "%kernel.project_dir%/config/routes_rest.yaml" does not exist (in: "") in %kernel.project_dir%/config/routes_rest.yaml (which is being imported from "/var/www/config/routes.yaml"). Make sure there is a loader supporting the "rest_options" type.
Something should be fixed to be able to use the relative path.
Best regards,
Adrien Dupuis
Technical Content Developer
Knowledge Team