-
Notifications
You must be signed in to change notification settings - Fork 49
Would be nice to allow multiple identifiers for a route #36
Comments
You can do this with RPC calls. See https://github.com/zfcampus/zf-apigility-doctrine/blob/master/src/Server/Controller/RpcController.php for a working example of Anything deeper than one should be referenced as /field_resource/field_resource_id |
@dstockto Have you given it a try yet? One other possibility is to use a combination identifier, and split it in your resource. As an example, your route would be |
Apigility Doctrine supports multi-key splitting by default using the '.' separator, therefore supporting a route like this: /orderdetails/num.code. Of course a very simple callback on event 'renderEntity' pushing the composed key in the 'self' link solves the problem (literally 5 lines of code). It would be nice though to have the functionality available out of the box from the service configuration. |
This repository has been closed and moved to laminas-api-tools/api-tools-hal; a new issue has been opened at laminas-api-tools/api-tools-hal#23. |
I think this would be a useful feature but I'm also open to feedback on how I might be doing it wrong or should be doing something differently. I have a route which includes 3 identifiers. My route essentially looks like
/api/apiname/resource/:resourceId[/subtype1/:subtype1/subtype2/:subtype2]
I don't really want to make another resource which was just resource id and subtype 1, and I don't think putting in 2 optional parts in the route is a good way to go. It doesn't appear that I can set any more than a single string as the identifier. In the example above, the HAL links for the entity won't include both subtype1 and subtype2, but does contain up to :resourceId.
If route identifier were allowed to be an array, it seems that the above would be possible, but considering the number of places that this touches, I wanted to get some feedback on it before going forward with a change or PR.
To me, it seems this could be a good idea and I don't see a problem with being able to support it, but would appreciate feedback.
The text was updated successfully, but these errors were encountered: