mongodb / laravel-mongodb

A MongoDB based Eloquent model and Query builder for Laravel (Moloquent)
https://www.mongodb.com/docs/drivers/php/laravel-mongodb/
MIT License
7.02k stars 1.43k forks source link

Overwrite $resolver generating problems when we use Eloquent as standalone ORM #451

Closed pgrzesiecki closed 9 years ago

pgrzesiecki commented 9 years ago

Hello,

Do laravel-mongodb have to overwrite $resolver in Jenssegers/Mongodb/Model.php ? When I use Eloqent as standalone ORM (without Laravel), this attribute makes problems.

$capsule = new Illuminate\Database\Capsule\Manager();
$manager = $capsule->getDatabaseManager();
$manager->extend('mongodb', function ($config) {
    return new Jenssegers\Mongodb\Connection($config);
});
$capsule->addConnection($connectionParameters);

$capsule->setAsGlobal();
$capsule->bootEloquent();

problem is with static methods like Model::find(X). This methods call new static instance. And now, when Eloquent model have this static $resolver, variable is overwritten in new instance by laravel-mongodb model with empty $resolver.

illuminate/database: 5.0.4 jenssegers/mongodb: dev-master

Thank in advance for help

jenssegers commented 9 years ago

It was already removed on the develop branch. Removed it from master as well.