You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CHANGELOG.md
+20-1Lines changed: 20 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,10 +2,29 @@
2
2
All notable changes to this project will be documented in this file.
3
3
4
4
## [Unreleased]
5
+
None yet.
6
+
7
+
## [10.0] - 2023-08-22
8
+
9
+
### Added
10
+
- MongoDB v6.0 supports and tests
11
+
- use Mongosh in tests instead of the old Mongo
12
+
- Mysql 8 Hybrid relation tests
13
+
14
+
### Removed
15
+
- MongoDB v4.* support was dropped
16
+
17
+
### Fixed
18
+
- Fixing the priority between attributes and relations dynamic property call to be the same as Laravel, that mean attribute first then relation (previous it was relation then attribute)
19
+
- using function names that exist as attribute accessor/caster: previously if you use a function name that has an accessor; say u use foo() and you have getFooAttribute, calling $model->foo will always fail as the function is called before the accessor, this has been fixed.
20
+
21
+
### Breaking
22
+
- EmbedsOne and EmbedsMany now require return type to work (Example in the documentation has been updated)
23
+
- You can't have the belongsToMany foreign key to be the same as the relation name (check documentation for more details)
5
24
6
25
## [3.9.2] - 2022-09-01
7
26
8
-
### Addded
27
+
### Addded
9
28
- Add single word name mutators [#2438](https://github.com/jenssegers/laravel-mongodb/pull/2438) by [@RosemaryOrchard](https://github.com/RosemaryOrchard) & [@mrneatly](https://github.com/mrneatly).
Copy file name to clipboardExpand all lines: README.md
+11-3Lines changed: 11 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -839,19 +839,23 @@ class User extends Model
839
839
}
840
840
}
841
841
```
842
+
**Warning:** naming the foreign key same as the relation name will prevent the relation for being called on dynamic property, i.e. in the example above if you replaced `group_ids` with `groups` calling `$user->groups` will return the column instead of the relation.
842
843
843
844
### EmbedsMany Relationship
844
845
845
846
If you want to embed models, rather than referencing them, you can use the `embedsMany` relation. This relation is similar to the `hasMany` relation but embeds the models inside the parent object.
846
847
847
848
**REMEMBER**: These relations return Eloquent collections, they don't return query builder objects!
848
849
850
+
**Breaking changes** starting from v10.0 you need to define the return type of EmbedsOne and EmbedsMany relation for it to work
851
+
849
852
```php
850
853
use Jenssegers\Mongodb\Eloquent\Model;
854
+
use Jenssegers\Mongodb\Relations\EmbedsMany;
851
855
852
856
class User extends Model
853
857
{
854
-
public function books()
858
+
public function books(): EmbedsMany
855
859
{
856
860
return $this->embedsMany(Book::class);
857
861
}
@@ -920,10 +924,11 @@ Like other relations, embedsMany assumes the local key of the relationship based
0 commit comments