- Build the association between User and Sport entities : ~2 hours.
It's a one-to-many unidirectional (one User can have many Sport).
See http://doctrine-orm.readthedocs.org/projects/doctrine-orm/en/latest/reference/association-mapping.html#one-to-many-unidirectional-with-join-table
-
Integrate the User->Sport association by creating a field in the AdminBundle/BaseUserAdmin : ~3 hours.
We must be able to add multiple sports to an user (from all types).
We must be able to remove multiple sports from an user (from all types).
(Same as previous association's embedded fields, but the Sport entity is already known by Sonata). -
Make a working multi-upload in CoachAdmin : ~3 hours.
- POST /v1/users/{id}/picture
parameters:file, type:file (resouece) controller: UserBundle
method: updatePicture
You have to use uploadPicture() method of the User entity.
Ask Thomas for which format you will receive the image (base64, ... I think multi-part/form-data should be the right way).
See documentation and stackoverlow for how handle file upload in REST.
When you the file is retrieved in request, take example from the BaseUserAdmin (called in prePersist and preUpdate) to see how upload the file (! note: you will do setFile() manually) .
Use an HTTP client like Postman for testing, only when you know the format.
(Add the two next resources to the 'Followers' ticket (#28) which have the tasks but need details for Thuy)
-
GET /v1/users/{id}/followers
controller: UserBundle/UsersController
method: getFollowers($id)
Returns the followers of a User (all users which are following the given user {id}) -
GET /v1/users/{id}/follows
controller: UserBundle/UsersController
method: getFollows($id)
Returns the follows of a User (all users followed by the given user {id})
-
GET /v1/users/{id}/sports
controller: UserBundle/UsersController
method: getSports($id)
Returns the list of Sports associated to the given User. (represented by $id in uri) -
POST /v1/users/{id}/sports
parameters: 'sport_id' (the sport to be added), requirements: \d+ (int regexp for @Rest\RequestParam annotation), required, not blank.
controller: UserBundle/UsersController
method: addSport($id)
Add a sport to the given user (represented by $id in uri) -
DELETE /v1/users/{id}/sports
parameters: 'sport_id' (the sport to remove), requirements: \d+ (int regexp for @Rest\RequestParam annotation), required, not blank.
controller: UserBundle/UsersController
method: removeSport($id)
Remove a sport from the given user (represented by $id in uri)