jonathandey / oc-jd-dingoapi

Dingo/API implementation for OctoberCMS
MIT License
16 stars 7 forks source link

October\Rain\Events\Dispatcher given error #8

Closed AugmentBLU closed 4 years ago

AugmentBLU commented 6 years ago

I'm trying your plugin with OC 426 which uses Laravel 5.5 but I'm getting this error. I tried to tinker with it but not getting very far. Any ideas?

Type error: Argument 1 passed to Dingo\Api\Http\Response::setEventDispatcher() must be an instance of Illuminate\Events\Dispatcher, instance of October\Rain\Events\Dispatcher given, called in /home/vagrant/website/vendor/dingo/api/src/Provider/DingoServiceProvider.php on line 37
jonathandey commented 6 years ago

I will have to look in to this. It looks like October\Rain dispatcher now extends Illuminate\Contracts\Events\Dispatcher rather than Illuminate\Events\Dispatcher.

This may require an update from DingoApi. If they haven't done it already!

jonathandey commented 6 years ago

The class Illuminate\Events\Dispatcher still exists in Illuminate it just looks like OC have decided to write their own implementation rather than extend it.

While I look in to this, it might be worth asking them why they have chosen to do this.

AugmentBLU commented 6 years ago

Thanks for the reply.

I spoke with Spunky and Luke on Slack and they're making some changes to how OC extends Laravel to make it more compatible. I'm not sure if this will help this issue out but we will see.

I had to make 2 hardcoded changes to the dingo api to get it to work with OC. Changed the Response and Middleware Request files. Not ideal but it helped.

use October\Rain\Events\Dispatcher as EventDispatcher;

nest-don commented 6 years ago

AugmentBLU, what changes did you make to the Response and Middleware Request files?

jaaparenas commented 6 years ago

I have changed the same code in the file... dingo/api/src/Http/Response.php

chrisvidal commented 6 years ago

as for 10 of September 2018, the issue is still there and has to be hard coded patched.

jonathandey commented 4 years ago

This should now be resolved.