Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Build REST APi with complex entity

Tags:

rest

symfony

I'm building REST API for my system with complex entities that have many relationship with each other. I'm looking for a way to automatically return entities with one-to-many or many-to-many relationship or I have to do it by hand. Any suggestion? Thanks for your help

like image 418
Tuan nguyen Avatar asked Jun 12 '26 03:06

Tuan nguyen


1 Answers

JMS/Serializer can serialize retations if you set Array or ArrayCollection type. You can install it with php composer.phar require jms/serializer-bundle. Read more at documentation.

like image 185
Alexey B. Avatar answered Jun 13 '26 23:06

Alexey B.