leroy-merlin-br / mongolid-laravel

Easy, powerful and ultrafast MongoDB ODM for Laravel.
MIT License
240 stars 41 forks source link

Change fire() to dispatch() for Laravel 5.8 #129

Closed bradleygreen closed 5 years ago

bradleygreen commented 5 years ago

Event Dispatcher function fire() has been deprecated in Larvel 5.8 as described here: https://github.com/kristijanhusak/laravel-form-builder/issues/492. The dispatch() function is the updated way to call this functionality. I have made the change here to add compatibility.

ravanscafi commented 5 years ago

Hello @bradleygreen. Thanks very much for your contribution! However, we are working on a new version that already addressed this issue. It is the other open PR https://github.com/leroy-merlin-br/mongolid-laravel/pull/126. I was not aware that someone was using/testing mongolid. If you want to give a try, please try the new version :)

Just put these two keys on your composer.json file:

    "minimum-stability": "dev",
    "prefer-stable": true

and then run:

composer require "leroy-merlin-br/mongolid-laravel=^3.0"

Have fun!

bradleygreen commented 5 years ago

I was not aware that someone was using/testing mongolid. If you want to give a try, please try the new version :)

Thank you for your quick response. I'll try that. We have a production web site currently using Laravel 4.2 and we are in the process of upgrading it to the latest available of everything. So we are switching from zizaco/mongolid-laravel to leroy-merlin-br/mongolid-laravel so it will work with PHP 7.2 and Laravel 5.8. This deprecation was the first problem we experienced.

Obrigado por sua ajuda! (morei no Rio por 2 anos)

bradleygreen commented 5 years ago

I tried your steps and got a composer message that I could only have one leroy-merlin-br/mongolid-laravel packages installed. So I removed the package I currently had composer remove leroy-merlin-br/mongolid-laravel and then tried to require it. I then got the message:

In ProviderRepository.php line 208: Class 'MongolidLaravel\MongolidServiceProvider' not found

So I tried requiring leroy-merlin-br/mongolid first and got this message: Your requirements could not be resolved to an installable set of packages.

Problem 1

  • Conclusion: don't install leroy-merlin-br/mongolid v2.1.5
  • Conclusion: don't install leroy-merlin-br/mongolid v2.1.4
  • Conclusion: don't install leroy-merlin-br/mongolid v2.1.3
  • Conclusion: don't install leroy-merlin-br/mongolid v2.1.2
  • Conclusion: don't install leroy-merlin-br/mongolid V2.1.1
  • Conclusion: don't install leroy-merlin-br/mongolid v2.1.0
  • leroy-merlin-br/mongolid-laravel v3.x-dev requires leroy-merlin-br/mongolid ^3.0 -> satisfiable by leroy-merlin-br/mongolid[v3.x-dev].
  • leroy-merlin-br/mongolid-laravel v3.x-dev requires leroy-merlin-br/mongolid ^3.0 -> satisfiable by leroy-merlin-br/mongolid[v3.x-dev].
  • leroy-merlin-br/mongolid-laravel v3.x-dev requires leroy-merlin-br/mongolid ^3.0 -> satisfiable by leroy-merlin-br/mongolid[v3.x-dev].
  • Can only install one of: leroy-merlin-br/mongolid[2.1.x-dev, v3.x-dev].
  • Can only install one of: leroy-merlin-br/mongolid[v3.x-dev, 2.1.x-dev].
  • Can only install one of: leroy-merlin-br/mongolid[2.1.x-dev, v3.x-dev].
  • Installation request for leroy-merlin-br/mongolid ^2.1 -> satisfiable by leroy-merlin-br/mongolid[V2.1.1, 2.1.x-dev, v2.1.0, v2.1.2, v2.1.3, v2.1.4, v2.1.5].
  • Installation request for leroy-merlin-br/mongolid-laravel (locked at v3.x-dev) -> satisfiable by leroy-merlin-br/mongolid-laravel[v3.x-dev].

Installation failed, reverting ./composer.json to its original content.

What am I missing? How to I get composer to install it? Maybe just manually edit the composer.json file and do composer install or composer update? Thoughts?

ravanscafi commented 5 years ago

Sorry, indeed we need to force mongolid version either! I believe that this should do the trick:

composer require "leroy-merlin-br/mongolid=^3.0" "leroy-merlin-br/mongolid-laravel=^3.0"
bradleygreen commented 5 years ago

I manually added them to my composer.json and updated and they installed. Here are the packages I have now: "leroy-merlin-br/mongolid": "^3.0", "leroy-merlin-br/mongolid-laravel": "^3.0",

I'm getting some weird results now. When I query my mongo collections using the first() function, I get a standard object which doesn't have any class methods (including none of my getters or setters). Advice?