adr/2021_06_15_api_platform_config_customization.md
Sylius is by design application that will be adjusted to customer needs. Therefore each part of it has to be crafted with replaceability or customizability at its core. Nonetheless, the current state of API Platform integration requires the replacement of the whole config of the whole resource. In terms of the more complicated cases like Order or Customer, this practice may become error-prone and hard to maintain for both maintainers and Sylius users.
For now, the only way to customize API resources is by overwriting the entire configuration associated with the endpoint.
To configure endpoint specify mapping file in config.
mapping:
paths: ['%kernel.project_dir%/config/api_platform']
in specified directory all we need to do is create config we want to overwrite, for example:
'%sylius.model.zone.class%':
collectionOperations:
admin_get:
enabled: false
This is example config to remove specific operation, more examples can be found in docs (https://docs.sylius.com/en/latest/customization/api/index.html).
Chosen option: "Config merging", because it allows us easily overwrite any endpoint, without getting deep into api platform resources.