laravel5-jsonapi
laravel5-jsonapi copied to clipboard
Lumen installation throws action() exception
I am trying to implement this with a Lumen application, and I get the following exception:
"exception": {
"type": "FatalThrowableError",
"file": "JsonApiTrait.php",
"line": 74,
"message": "Fatal error: Call to undefined function NilPortugues\Laravel5\JsonApi\Controller\action()"
}
Am I missing something or are there compatibility problems?
JsonApiTrait uses the action() helper, which is unavailable with Lumen.
I think something went wrong in my set-up. I re-did everything and didn't get this error anymore.
I am getting this, however:
"status": 400, "title": "Bad Request", "detail": "Request could not be served."
Not much to go by here... Any tips?
Hmm go to the NilPortugues\Laravel5\JsonApi\Controller\JsonApiTrait and go to the exception bit matching your action and do a print_r or a $e->getMessage.
You'll get the info there.
I've been already requested to add a dev flag to let these errors go up, instead of catching them. But haven't had time to add the feature yet.
I am getting the first error again... It's because JsonApiTrait uses the action() helper on line 74. Is it supposed to do this?
I change it to this and I get the second error instead (Which also appears on the show-page): $uri = route('myresource.index'); // action($controllerAction, []);
Edit: It turns out the second error is caused by this: Undefined index: App\Party\Property\Property
. It's probably specific to my other code, so I will figure it out myself. But the above problem still remains!
@OskarD did you solve this? I'm actually curious what was making it happen... so maybe I can add a defensive check.
@nilportugues no, it's still happening.
Why is it calling the action() helper-function? Is it supposed to happen? It isn't featured in Lumen
@nilportugues the action() function is not available in Lumen, it shouldn't be called in JsonApiTrait (Line 74) if using Lumen, should it?
https://github.com/nilportugues/laravel5-jsonapi/releases/tag/2.1.11
Try updating your composer dependency to use release 2.1.11
.
Thank you @nilportugues for helping out, but I'm afraid it isn't enough
$absolute
in the action
arguments needs to be defaulted to true
for the code to run without a Missing argument 3
error, and after fixing that I get this error instead: Fatal error: Call to undefined method Laravel\Lumen\Routing\UrlGenerator::action()
I don't think Lumen offers the action functionality at all :/
I'll have to hack it better. Not at home right now. Sorry is taking so long.
It's OK, I am very glad you are willing to help :)
@nilportugues have you had the chance to take a look at this yet?
Starting tomorrow evening I'll be capable to look into it. Been quite busy lately
Any news @nilportugues?