copying controller actions to the LumenJSONAPIController#105
copying controller actions to the LumenJSONAPIController#105mansona wants to merge 2 commits intonilportugues:masterfrom
Conversation
| * | ||
| * @return \Symfony\Component\HttpFoundation\Response | ||
| */ | ||
| public function index() |
There was a problem hiding this comment.
Line indented incorrectly; expected 4 spaces, found 5
| $apiRequest = RequestFactory::create(); | ||
|
|
||
| $page = $apiRequest->getPage(); | ||
| if (!$page->size()) { |
There was a problem hiding this comment.
Line indented incorrectly; expected 8 spaces, found 9
| $page = $apiRequest->getPage(); | ||
| if (!$page->size()) { | ||
| $page->setSize($this->pageSize); | ||
| } |
There was a problem hiding this comment.
Line indented incorrectly; expected 12 spaces, found 9
| $page->setSize($this->pageSize); | ||
| } | ||
|
|
||
| $fields = $apiRequest->getFields(); |
There was a problem hiding this comment.
Line indented incorrectly; expected at least 12 spaces, found 9
| } | ||
|
|
||
| $fields = $apiRequest->getFields(); | ||
| $sorting = $apiRequest->getSort(); |
There was a problem hiding this comment.
Line indented incorrectly; expected at least 12 spaces, found 9
|
|
||
| $fields = $apiRequest->getFields(); | ||
| $sorting = $apiRequest->getSort(); | ||
| $included = $apiRequest->getIncludedRelationships(); |
There was a problem hiding this comment.
Line indented incorrectly; expected at least 12 spaces, found 9
| $fields = $apiRequest->getFields(); | ||
| $sorting = $apiRequest->getSort(); | ||
| $included = $apiRequest->getIncludedRelationships(); | ||
| $filters = $apiRequest->getFilters(); |
There was a problem hiding this comment.
Line indented incorrectly; expected at least 12 spaces, found 9
| $included = $apiRequest->getIncludedRelationships(); | ||
| $filters = $apiRequest->getFilters(); | ||
|
|
||
| $resource = new ListResource($this->serializer, $page, $fields, $sorting, $included, $filters); |
There was a problem hiding this comment.
Line indented incorrectly; expected at least 12 spaces, found 9
|
|
||
| $resource = new ListResource($this->serializer, $page, $fields, $sorting, $included, $filters); | ||
|
|
||
| $totalAmount = $this->totalAmountResourceCallable(); |
There was a problem hiding this comment.
Line indented incorrectly; expected at least 12 spaces, found 9
| $resource = new ListResource($this->serializer, $page, $fields, $sorting, $included, $filters); | ||
|
|
||
| $totalAmount = $this->totalAmountResourceCallable(); | ||
| $results = $this->listResourceCallable(); |
There was a problem hiding this comment.
Line indented incorrectly; expected at least 12 spaces, found 9
| $totalAmount = $this->totalAmountResourceCallable(); | ||
| $results = $this->listResourceCallable(); | ||
|
|
||
| $controllerAction = '\\'.get_called_class().'@index'; |
There was a problem hiding this comment.
Line indented incorrectly; expected at least 12 spaces, found 9
| $results = $this->listResourceCallable(); | ||
|
|
||
| $controllerAction = '\\'.get_called_class().'@index'; | ||
| $uri = $this->uriGenerator($controllerAction); |
There was a problem hiding this comment.
Line indented incorrectly; expected at least 12 spaces, found 9
| $controllerAction = '\\'.get_called_class().'@index'; | ||
| $uri = $this->uriGenerator($controllerAction); | ||
|
|
||
| return $this->addHeaders($resource->get($totalAmount, $results, $uri, get_class($this->getDataModel()))); |
There was a problem hiding this comment.
Line indented incorrectly; expected at least 12 spaces, found 9
| $uri = $this->uriGenerator($controllerAction); | ||
|
|
||
| return $this->addHeaders($resource->get($totalAmount, $results, $uri, get_class($this->getDataModel()))); | ||
| } |
There was a problem hiding this comment.
Line indented incorrectly; expected 8 spaces, found 5
| * | ||
| * @return \Symfony\Component\HttpFoundation\Response | ||
| */ | ||
| public function show($id) |
There was a problem hiding this comment.
Line indented incorrectly; expected 8 spaces, found 5
| * @return \Symfony\Component\HttpFoundation\Response | ||
| */ | ||
| public function show($id) | ||
| { |
There was a problem hiding this comment.
Line indented incorrectly; expected at least 8 spaces, found 5
| */ | ||
| public function show($id) | ||
| { | ||
| $apiRequest = RequestFactory::create(); |
There was a problem hiding this comment.
Line indented incorrectly; expected at least 12 spaces, found 9
| { | ||
| $apiRequest = RequestFactory::create(); | ||
|
|
||
| $resource = new GetResource( |
There was a problem hiding this comment.
Line indented incorrectly; expected at least 12 spaces, found 9
| $find = $this->findResourceCallable($id); | ||
|
|
||
| return $this->addHeaders($resource->get($id, get_class($this->getDataModel()), $find)); | ||
| } |
There was a problem hiding this comment.
Line indented incorrectly; expected 8 spaces, found 5
| /** | ||
| * @return ResourceNotFound | ||
| */ | ||
| public function create() |
There was a problem hiding this comment.
Line indented incorrectly; expected 8 spaces, found 5
| * @return ResourceNotFound | ||
| */ | ||
| public function create() | ||
| { |
There was a problem hiding this comment.
Line indented incorrectly; expected at least 8 spaces, found 5
| */ | ||
| public function create() | ||
| { | ||
| return new ResourceNotFound(); |
There was a problem hiding this comment.
Line indented incorrectly; expected at least 12 spaces, found 9
| public function create() | ||
| { | ||
| return new ResourceNotFound(); | ||
| } |
There was a problem hiding this comment.
Line indented incorrectly; expected 8 spaces, found 5
| * | ||
| * @return \Symfony\Component\HttpFoundation\Response | ||
| */ | ||
| public function store(Request $request) |
There was a problem hiding this comment.
Line indented incorrectly; expected 8 spaces, found 5
| * @return \Symfony\Component\HttpFoundation\Response | ||
| */ | ||
| public function store(Request $request) | ||
| { |
There was a problem hiding this comment.
Line indented incorrectly; expected at least 8 spaces, found 5
| */ | ||
| public function store(Request $request) | ||
| { | ||
| $createResource = $this->createResourceCallable(); |
There was a problem hiding this comment.
Line indented incorrectly; expected at least 12 spaces, found 9
| public function store(Request $request) | ||
| { | ||
| $createResource = $this->createResourceCallable(); | ||
| $resource = new CreateResource($this->serializer); |
There was a problem hiding this comment.
Line indented incorrectly; expected at least 12 spaces, found 9
| { | ||
| $createResource = $this->createResourceCallable(); | ||
| $resource = new CreateResource($this->serializer); | ||
| return $this->addHeaders( |
There was a problem hiding this comment.
Line indented incorrectly; expected at least 12 spaces, found 9
| $createResource = $this->createResourceCallable(); | ||
| $resource = new CreateResource($this->serializer); | ||
| return $this->addHeaders( | ||
| $resource->get((array) $request->get('data'), get_class($this->getDataModel()), $createResource) |
There was a problem hiding this comment.
- Multi-line function call not indented correctly; expected 13 spaces but found 11
- Line indented incorrectly; expected at least 12 spaces, found 11
| return $this->addHeaders( | ||
| $resource->get((array) $request->get('data'), get_class($this->getDataModel()), $createResource) | ||
| ); | ||
| } |
There was a problem hiding this comment.
Line indented incorrectly; expected 8 spaces, found 5
| * | ||
| * @return Response | ||
| */ | ||
| public function update(Request $request, $id) |
There was a problem hiding this comment.
Line indented incorrectly; expected 8 spaces, found 5
| * @return Response | ||
| */ | ||
| public function update(Request $request, $id) | ||
| { |
There was a problem hiding this comment.
Line indented incorrectly; expected at least 8 spaces, found 5
| */ | ||
| public function update(Request $request, $id) | ||
| { | ||
| return (strtoupper($request->getMethod()) === 'PUT') ? $this->putAction($request, |
There was a problem hiding this comment.
- Line indented incorrectly; expected at least 12 spaces, found 9
- Opening parenthesis of a multi-line function call must be the last content on the line
| public function update(Request $request, $id) | ||
| { | ||
| return (strtoupper($request->getMethod()) === 'PUT') ? $this->putAction($request, | ||
| $id) : $this->patchAction($request, $id); |
There was a problem hiding this comment.
- Multi-line function call not indented correctly; expected 9 spaces but found 13
- Closing parenthesis of a multi-line function call must be on a line by itself
| { | ||
| return (strtoupper($request->getMethod()) === 'PUT') ? $this->putAction($request, | ||
| $id) : $this->patchAction($request, $id); | ||
| } |
There was a problem hiding this comment.
Line indented incorrectly; expected 8 spaces, found 5
| /** | ||
| * @return ResourceNotFound | ||
| */ | ||
| public function edit() |
There was a problem hiding this comment.
Line indented incorrectly; expected 8 spaces, found 5
|
I don't know why the tests are failing, but from what I can see master is also having issues 🤔 |
Hi Folks,
First of all thanks for the great library 👍 It's always good to see people solving the hard problems so the rest of us don't have to don't have to 😉
I was trying to get this library to work with lumen (instead of Laravel) and it didn't seem to work. I noticed that things seemed to be pulled out of the JsonApiTrait in this commit c96e65f but they weren't added to the LumenJsonApiController at the same time.
The changes in this PR work for me when it comes to simple objects using Eloquent with Lumen but it doesn't seem to work with relationships, I will continue that part of the discussion on the issue here nilportugues/php-api-transformer#10