File tree Expand file tree Collapse file tree 2 files changed +11
-0
lines changed
src/Jenssegers/Mongodb/Relations Expand file tree Collapse file tree 2 files changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -186,6 +186,16 @@ public function save(Model $model)
186
186
return false ;
187
187
}
188
188
189
+ /**
190
+ * Get the number of embedded documents.
191
+ *
192
+ * @return int
193
+ */
194
+ public function count ()
195
+ {
196
+ return count ($ this ->getEmbeddedRecords ());
197
+ }
198
+
189
199
/**
190
200
* Attach a model instance to the parent model without persistence.
191
201
*
Original file line number Diff line number Diff line change @@ -327,6 +327,7 @@ public function testEmbedsManySave()
327
327
$ this ->assertEquals (2 , count ($ user ->addresses ));
328
328
$ this ->assertEquals (2 , count ($ user ->addresses ()->get ()));
329
329
$ this ->assertEquals (2 , $ user ->addresses ->count ());
330
+ $ this ->assertEquals (2 , $ user ->addresses ()->count ());
330
331
$ this ->assertEquals (array ('London ' , 'New York ' ), $ user ->addresses ->lists ('city ' ));
331
332
332
333
$ freshUser = User::find ($ user ->_id );
You can’t perform that action at this time.
0 commit comments