-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Update QueryBuilder get method to run getFresh method #619
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’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Following the latest update of the laravel framework (5.1.20), the BaseQuery builder that used to just run the getFresh method (overriden by the mongodb child builder) in the get function, now calls the runSelect method that relies on the mysql Grammar object being present that this builder does not need to run. This update simply removes the parent get() call and directly calls it's own getFresh method, thus return the functionality to what it was before the laravel update.
Update QueryBuilder get method to run getFresh method
Thanks! |
Same issue facing .. "Fatal error: Call to a member function compileSelect() on null" Can you help how to solve ? |
I fixed it by changing the extends class from "Model" to "Eloquent" in my DB model |
@fuzonmedia i'm facing this problem now but i can't understand which file you had change model to eloquent ? |
@ahmedash95 you have to change it in your model file use Jenssegers\Mongodb\Eloquent\Model as Eloquent; class User extends Eloquent {}
|
@fuzonmedia okay i got it , but i change it in the Authenticate class in the laravel core itself and it works fine for me |
@ahmedash95 Because overriding core classes is always wrong as they will be overriden in the next Laravel upgrade via composer, I think it's a good idea to introduce new App\MongoUser class over which you have full control. And then change your User model to: That works for me 👍 |
@Ravaelles thanks ^_^ 👍 |
For reference, I was getting the above error when using Cashier (User and Subscriptions are MySQL backed). The issue was because the default connection is set to mongo, the Cashier Models where looking in the wrong place. I forked Cashier to fix, setting the connection direction on the subscription model. |
thanks to @Ravaelles for some one new with same problem her is full Class:
and then
Works like a charm I have used this with Laravel 5.3 |
Update QueryBuilder get method to run getFresh method
Following the latest update of the laravel framework (5.1.20), the BaseQuery builder that used to just run the getFresh method (overriden by the mongodb child builder) in the get function, now calls the runSelect method that relies on the mysql Grammar object being present that this builder does not need to run.
This results in the error
Call to a member function compileSelect() on null
when trying to run a query.This update simply removes the parent get() call and directly calls it's own getFresh method, thus return the functionality to what it was before the laravel update.
The particular change in laravel that causes this issue can be seen here:
laravel/framework@v5.1.19...v5.1.20#diff-cc3d43e01028390141596ae0da939930L1373
Fixes #618