Skip to content

Commit 8f1bb4e

Browse files
committed
Update readme
1 parent e6e95f3 commit 8f1bb4e

File tree

1 file changed

+19
-9
lines changed

1 file changed

+19
-9
lines changed

README.md

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -68,21 +68,31 @@ $capsule->getDatabaseManager()->extend('mongodb', function($config)
6868
Upgrading
6969
---------
7070

71-
### Upgrading 2.2.x to 3.0.x
71+
### Upgrading from version 2 to 3
7272

73-
In this new major release which supports the new mongodb PHP extension, we also moved the location of the Model class from:
73+
In this new major release which supports the new mongodb PHP extension, we also moved the location of the Model class and replaced the MySQL model class with a trait.
7474

75-
```
76-
Jenssegers\Mongodb\Model
77-
```
75+
Please change all `Jenssegers\Mongodb\Model` references to `Jenssegers\Mongodb\Eloquent\Model` either at the top of your model files, or your registered alias.
7876

79-
To:
77+
```php
78+
use Jenssegers\Mongodb\Eloquent\Model as Eloquent;
8079

80+
class User extends Eloquent {}
8181
```
82-
Jenssegers\Mongodb\Eloquent\Model
83-
```
8482

85-
So please use the new namespace at the top of your model files, or in your alias.
83+
If you are using hybrid relations, your MySQL classes should now extend the original Eloquent model class `Illuminate\Database\Eloquent\Model` instead of the removed `Jenssegers\Eloquent\Model`. Instead it should now use the `Jenssegers\Mongodb\Eloquent\HybridRelations` trait. This should make things more clear as there is only one single model class in this package.
84+
85+
```php
86+
use Jenssegers\Mongodb\Eloquent\HybridRelations;
87+
88+
class User extends Eloquent {
89+
90+
use HybridRelations;
91+
92+
protected $connection = 'mysql';
93+
94+
}
95+
```
8696

8797
Configuration
8898
-------------

0 commit comments

Comments
 (0)