I have an array from a database in Symfony Doctrine that looks like this (using dd()):
array:2 [
0 => App\Entity\Bg {#518
-id: 2
-name: "company"
-partner: "Bill"
-mail: "mail"
-status: "awaiting"
-last_changed: "25.03.2020"
}
1 => App\Entity\Bg {#520
-id: 3
-name: "company 2"
-partner: "Max"
-mail: "mail"
-status: "awaiting"
-last_changed: "25.03.2020"
}
]
after using
json_encode($bgs);
the result is only
"[{},{}]"
What exactly is going on behind the scenes? Obviously I want json_encode to transform my array into a json_array, so I can send it in a response.