Comments (4)
IMO, I think we should separate 2 cleaned parts:
- GET, POST, PUT, DELETE will be handled by RestController
- All the others (with '_' prefix,
_all
,_batch
for instance) which I calledcommands
, will be handled byCommandController
. It's very easy to implement new commands
You could take a look on my work (still be in progress)
trandangtri@a9e214b#diff-47c6f7be84a1fcdde5ffc18ec6958135R20
What do you think about this, @saimaz?
from apibundle.
I'll take a look tomorrow.
As of two parts. CommandController
is not very accurate name for _batch
and _all
. I know that it might be more some same routes, but it should be named something like ColelctionController
or the other way is create separate controller for batch and for all, then it will make more sense. Even if we will add some other not traditional route, it will be clean way to do it with separate controller. Also imagine if there will be needed to add some additional parameters to both controllers, then it will become more complex. So I vote for separate controller for each action _batch
and _all
.
Maybe @mvar has some thoughts and advises?
from apibundle.
Sorry, no suggestions. I just don't like the name command
. Besides that everything sounds good. I like the idea to separate REST from non-REST.
from apibundle.
Thanks @mvar. I changed Command
to Collection
.
And I added a mapping configuration into the Abstract Collection class, so you could define yours commands in an individual class or separated classed.
/**
* Mapping of the commands
*
* @var array
*/
private $mapping = [
'_all' => [
'_controller' => 'ONGRApiBundle:Collection:all',
'methods' => ['GET'],
'validator' => 'allow_get_all'
],
'_batch' => [
'_controller' => 'ONGRApiBundle:Collection:batch',
'methods' => ['POST'],
'validator' => 'allow_batch'
]
];
from apibundle.
Related Issues (20)
- Implement oAuth2 authentication for the endpoints.
- Create `BatchController` controller to handle batch request HOT 1
- Create `GetAllController` controller to handle `_all` request
- Remove Collection controllers HOT 1
- Remove Routing namespace HOT 1
- Doubtful `RestRequest` need. HOT 1
- Do not inject routes by listener. HOT 3
- Other routes does not work when ApiBundle is enabled
- Write docs how to use variants HOT 1
- Return "_id" for failed batch processing via API
- Check if provided route config is correct
- Improve rest controller validation
- Batch does not produce a response
- Variants implementation should be deprecated
- Implement version recognition in Accept header HOT 3
- Implement `BatchProcessor` HOT 1
- Implement `RestController`
- Investigate the need of `Request\RestRequest`, `Request\RestRequestFactory`, `Request\RestRequestProxy` HOT 2
- Implement getAll action in RestController HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from apibundle.