File tree Expand file tree Collapse file tree 2 files changed +8
-4
lines changed Expand file tree Collapse file tree 2 files changed +8
-4
lines changed Original file line number Diff line number Diff line change 5
5
namespace MeiliSearch \Bundle \Test \Entity ;
6
6
7
7
use Doctrine \Common \Collections \ArrayCollection ;
8
+ use Doctrine \Common \Collections \Collection ;
8
9
use Doctrine \ORM \Mapping as ORM ;
9
10
use Symfony \Component \Serializer \Annotation \Groups ;
10
11
@@ -43,13 +44,14 @@ class Post
43
44
private ?\DateTime $ publishedAt = null ;
44
45
45
46
/**
46
- * @var Comment[]|ArrayCollection
47
+ * @var Comment[]|Collection
47
48
* @ORM\OneToMany(
48
49
* targetEntity="Comment",
49
50
* mappedBy="post",
50
51
* orphanRemoval=true
51
52
* )
52
53
* @ORM\OrderBy({"publishedAt": "DESC"})
54
+ * @Groups({"searchable"})
53
55
*/
54
56
private $ comments ;
55
57
@@ -119,7 +121,7 @@ public function setPublishedAt(?\DateTime $publishedAt): Post
119
121
return $ this ;
120
122
}
121
123
122
- public function getComments (): ?ArrayCollection
124
+ public function getComments (): ?Collection
123
125
{
124
126
return $ this ->comments ;
125
127
}
Original file line number Diff line number Diff line change @@ -52,7 +52,8 @@ public function testSimpleEntityToSearchableArray()
52
52
'posts ' ,
53
53
$ post ,
54
54
$ postMeta ,
55
- $ this ->get ('serializer ' )
55
+ $ this ->get ('serializer ' ),
56
+ ['useSerializerGroup ' => true ]
56
57
);
57
58
58
59
$ expected = [
@@ -62,8 +63,9 @@ public function testSimpleEntityToSearchableArray()
62
63
'publishedAt ' => $ serializedDateTime ,
63
64
'comments ' => [
64
65
[
66
+ 'id ' => null ,
65
67
'content ' => 'a great comment ' ,
66
- 'post_title ' => ' a simple post ' ,
68
+ 'publishedAt ' => $ serializedDateTime ,
67
69
],
68
70
],
69
71
];
You can’t perform that action at this time.
0 commit comments