php - Array and object issue in symfony

Solution:
Define your getters, and then use them.
for example in this
foreach ($productos as $producto)
{ $id = $producto->id; echo $id; }
Try
$producto->getId();
instead of
$producto->id;
assuming you defined your getter.
Answer
Solution:
$id = $producto->id;
This won't work because whether the property is not publicly accessible or the Object does not have that property.
TheWork
object hasdescription
, but it's private, so you'd have to create a getter function to echo it.
e.g
echo $producto->getDescription();
Share solution ↓
Additional Information:
Link To Answer People are also looking for solutions of the problem: the payload is invalid.
Didn't find the answer?
Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.
Similar questions
Find the answer in similar questions on our website.
Write quick answer
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.