This line:
var_dump($data['department']);
returns this:
object(Penny\HomeBundle\Entity\Department)[1420]
protected 'id' => int 37
protected 'name' => string 'Support' (length=7)
protected 'email' => string 'denis_nizetic@hotmail.com' (length=25)
When I try to do
var_dump(get_object_vars($data['department']));
I get
array
empty
I have no idea why does this happen if the object is there.
Edit: I fixed my problem with using $obj->getValue() methods (getters).
But the question is still there: why won’t get_object_vars() work?
From manual:
when your is
protected.Try get_class_vars.