Why does JMS Serializer ignore mappings for nested collections? Why does JMS Serializer ignore mappings for nested collections? symfony symfony

Why does JMS Serializer ignore mappings for nested collections?


Since there were no anwsers, I'll post what I eventually did/found out (for future reference and anyone who encounters the same problem). I'll quote my edit:

After some suggestions I added @ExclusionPolicy("ALL") annotation to the Brick class and @Expose on ID, just to see what happens.. and suddenly it works! Not only ID is exposed, but everything is like in my YML configuration.

So I removed the annotations.. and it still works!

So it seems that adding Annotations somehow forced serializer to recognize my YML config. I don't know why though. That worries me.


Apparently adding use JMS\Serializer\Annotation\ExclusionPolicy; to the entity is enough.

I m guessing it was not working because we did not implement the class to do so.