Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

copying controller actions to the LumenJSONAPIController #105

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

mansona
Copy link

@mansona mansona commented Oct 18, 2016

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

*
* @return \Symfony\Component\HttpFoundation\Response
*/
public function index()

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line indented incorrectly; expected 4 spaces, found 5

$apiRequest = RequestFactory::create();

$page = $apiRequest->getPage();
if (!$page->size()) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line indented incorrectly; expected 8 spaces, found 9

$page = $apiRequest->getPage();
if (!$page->size()) {
$page->setSize($this->pageSize);
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line indented incorrectly; expected 12 spaces, found 9

$page->setSize($this->pageSize);
}

$fields = $apiRequest->getFields();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line indented incorrectly; expected at least 12 spaces, found 9

}

$fields = $apiRequest->getFields();
$sorting = $apiRequest->getSort();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line indented incorrectly; expected at least 12 spaces, found 9


$fields = $apiRequest->getFields();
$sorting = $apiRequest->getSort();
$included = $apiRequest->getIncludedRelationships();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line indented incorrectly; expected at least 12 spaces, found 9

$fields = $apiRequest->getFields();
$sorting = $apiRequest->getSort();
$included = $apiRequest->getIncludedRelationships();
$filters = $apiRequest->getFilters();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line indented incorrectly; expected at least 12 spaces, found 9


$resource = new ListResource($this->serializer, $page, $fields, $sorting, $included, $filters);

$totalAmount = $this->totalAmountResourceCallable();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line indented incorrectly; expected at least 12 spaces, found 9

$totalAmount = $this->totalAmountResourceCallable();
$results = $this->listResourceCallable();

$controllerAction = '\\'.get_called_class().'@index';

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line indented incorrectly; expected at least 12 spaces, found 9

$results = $this->listResourceCallable();

$controllerAction = '\\'.get_called_class().'@index';
$uri = $this->uriGenerator($controllerAction);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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())));

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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())));
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line indented incorrectly; expected 8 spaces, found 5

*
* @return \Symfony\Component\HttpFoundation\Response
*/
public function show($id)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line indented incorrectly; expected 8 spaces, found 5

* @return \Symfony\Component\HttpFoundation\Response
*/
public function show($id)
{

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line indented incorrectly; expected at least 8 spaces, found 5

*/
public function show($id)
{
$apiRequest = RequestFactory::create();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line indented incorrectly; expected at least 12 spaces, found 9

{
$apiRequest = RequestFactory::create();

$resource = new GetResource(

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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));
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line indented incorrectly; expected 8 spaces, found 5

/**
* @return ResourceNotFound
*/
public function create()

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line indented incorrectly; expected 8 spaces, found 5

* @return ResourceNotFound
*/
public function create()
{

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line indented incorrectly; expected at least 8 spaces, found 5

*/
public function create()
{
return new ResourceNotFound();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line indented incorrectly; expected at least 12 spaces, found 9

public function create()
{
return new ResourceNotFound();
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line indented incorrectly; expected 8 spaces, found 5

*
* @return \Symfony\Component\HttpFoundation\Response
*/
public function store(Request $request)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line indented incorrectly; expected 8 spaces, found 5

* @return \Symfony\Component\HttpFoundation\Response
*/
public function store(Request $request)
{

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line indented incorrectly; expected at least 8 spaces, found 5

*/
public function store(Request $request)
{
$createResource = $this->createResourceCallable();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line indented incorrectly; expected at least 12 spaces, found 9

public function store(Request $request)
{
$createResource = $this->createResourceCallable();
$resource = new CreateResource($this->serializer);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line indented incorrectly; expected at least 12 spaces, found 9

{
$createResource = $this->createResourceCallable();
$resource = new CreateResource($this->serializer);
return $this->addHeaders(

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • 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)
);
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line indented incorrectly; expected 8 spaces, found 5

*
* @return Response
*/
public function update(Request $request, $id)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line indented incorrectly; expected 8 spaces, found 5

* @return Response
*/
public function update(Request $request, $id)
{

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line indented incorrectly; expected at least 8 spaces, found 5

*/
public function update(Request $request, $id)
{
return (strtoupper($request->getMethod()) === 'PUT') ? $this->putAction($request,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • 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);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • 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);
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line indented incorrectly; expected 8 spaces, found 5

/**
* @return ResourceNotFound
*/
public function edit()

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line indented incorrectly; expected 8 spaces, found 5

@mansona
Copy link
Author

mansona commented Oct 19, 2016

I don't know why the tests are failing, but from what I can see master is also having issues 馃

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants