File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -74,10 +74,14 @@ public function toArray(): array
7474 foreach ($ this ->fields as $ field ) {
7575 if ($ field instanceof \Spameri \ElasticQuery \Mapping \Settings \Mapping \SubFields) {
7676 $ fields [$ field ->key ()] = $ field ->toArray ();
77-
78- } else {
79- $ fields [$ field ->key ()] = $ field ->toArray ()[$ field ->key ()];
77+ continue ;
78+ }
79+ if ($ field instanceof \Spameri \ElasticQuery \Mapping \Settings \Mapping \FieldObject) {
80+ $ fields [$ field ->key ()] = $ field ->toArray ();
81+ continue ;
8082 }
83+
84+ $ fields [$ field ->key ()] = $ field ->toArray ()[$ field ->key ()];
8185 }
8286
8387 return [
Original file line number Diff line number Diff line change @@ -38,6 +38,15 @@ public function toArray(): array
3838 $ fields = [];
3939 /** @var \Spameri\ElasticQuery\Mapping\Settings\Mapping\FieldInterface $field */
4040 foreach ($ this ->fields as $ field ) {
41+ if ($ field instanceof \Spameri \ElasticQuery \Mapping \Settings \Mapping \FieldObject) {
42+ $ fields [$ field ->key ()] = $ field ->toArray ();
43+ continue ;
44+ }
45+ if ($ field instanceof \Spameri \ElasticQuery \Mapping \Settings \Mapping \FieldCollection) {
46+ $ fields [$ field ->key ()] = $ field ->toArray ();
47+ continue ;
48+ }
49+
4150 $ fields [$ field ->key ()] = $ field ->toArray ()[$ field ->key ()];
4251 }
4352
You can’t perform that action at this time.
0 commit comments