I did a little digging into drest and FOSRestBundle. Key impressions from documentation:
1. drest aims to be depend on Doctrine but nothing else. FOSRestBundle integrates a lot with Symfony – e.g. to define the format of PUT or POST requests, you create a Symfony Form.
2. drest includes baseline implementations for "GET", "PUT", etc actions. I didn't find a baseline in FOSRestBundle – rather, each action seems to require some custom code. (I was hopeful that we could write a parent-class with some baseline implementations, but it looks like that might not work with FOSRestBundle's naming/routing conventions.)
3. drest includes a code-generator for client-side PHP API. FOSRestBundle works with NelmioApiDocBundle to generate documentation and may have support for "HATEOAS".
In terms of what we want, some first thoughts:
a. We'll want to define a mix of baseline implementations, sharable implementations, and one-off implementations. drest isn't perfect but it's a clearer that it meets this requirement; there's maybe a 50% chance we could do something in FOSRestBundle using a base-class and magic functions – but at that point I think it negates any architectural value provided by FOSRestBundle.
b. Generating documentation & examples seems pretty important.
c. We'll want somewhere to tap in and apply some access-control logic (both generic/baseline logic and custom/one-off logic). Neither framework seems to deal with that head-on, but both allow writing
event listeners and (ii) custom actions, so that seems like a good way in. Tangential: http://symfony.com/doc/current/components/security/authorization.html
d. Civi 4.5 adds support for aggregating API requests – which is cool. I haven't found anything yet in FOSRestBundle or drest which seems comparable.
e. It'll be interesting to play around with the support for relations - to get a better sense for how they work out. Could potentially play the same role as "chaining" in APIv3.
I did a little digging into drest and FOSRestBundle. Key impressions from documentation:
1. drest aims to be depend on Doctrine but nothing else. FOSRestBundle integrates a lot with Symfony – e.g. to define the format of PUT or POST requests, you create a Symfony Form.
2. drest includes baseline implementations for "GET", "PUT", etc actions. I didn't find a baseline in FOSRestBundle – rather, each action seems to require some custom code. (I was hopeful that we could write a parent-class with some baseline implementations, but it looks like that might not work with FOSRestBundle's naming/routing conventions.)
3. drest includes a code-generator for client-side PHP API. FOSRestBundle works with NelmioApiDocBundle to generate documentation and may have support for "HATEOAS".
In terms of what we want, some first thoughts:
a. We'll want to define a mix of baseline implementations, sharable implementations, and one-off implementations. drest isn't perfect but it's a clearer that it meets this requirement; there's maybe a 50% chance we could do something in FOSRestBundle using a base-class and magic functions – but at that point I think it negates any architectural value provided by FOSRestBundle.
b. Generating documentation & examples seems pretty important.
c. We'll want somewhere to tap in and apply some access-control logic (both generic/baseline logic and custom/one-off logic). Neither framework seems to deal with that head-on, but both allow writing
event listeners and (ii) custom actions, so that seems like a good way in. Tangential: http://symfony.com/doc/current/components/security/authorization.html
d. Civi 4.5 adds support for aggregating API requests – which is cool. I haven't found anything yet in FOSRestBundle or drest which seems comparable.
e. It'll be interesting to play around with the support for relations - to get a better sense for how they work out. Could potentially play the same role as "chaining" in APIv3.