Hi, I am using symfony 3.3.15 to build a project that includes an API, and I am using fosrestbundle and jmsserializerbundle in which I have two entities, one ad and another category related to one and many, and when I consult the api for the ads returns me the ads and an arrangement with all the data of the category and I just need your id and the same way when I ask for the categories returns me a json with the categories and in a subarrange all ads that belong to the category and equally I just need your id here I send you an example
[
{
"id": 2,
"titulo": "Venta de monitor",
"descripccion": "ssasas",
"precio": 80,
"nombre": "JJJJJ",
"telefono": "XXXXXXX",
"auto": false,
"categoria": {
"id": 3,
"nombre": "Computadoras",
"slug": "computadoras",
"anuncios": [
{
"id": 4,
"titulo": "Vendo SmarTV",
"descripccion": "wefwef",
"precio": 120,
"nombre": "JJJJ",
"telefono": "XXXXXXX",
"auto": false,
"slug": "vendo-smartv",
"created": "2018-01-22T23:48:37+0100",
"updated": "2018-01-22T23:48:37+0100",
"image_name": "132124646_1GG.jpg",
"image1_name": "132124646_3GG.jpg"
}
]
},
"slug": "xxxxx",
"created": "2018-01-22T21:26:55+0100",
"updated": "2018-01-22T21:40:43+0100",
"image_name": "25UM58_7_170914.jpg"
},
{
"id": 3,
"titulo": "Vendo Casa",
"descripccion": "Casa frente al mar",
"precio": 15000,
"nombre": "JJJJJ",
"telefono": "XXXXXXX",
"auto": false,
"categoria": {
"id": 1,
"nombre": "Vivienda",
"slug": "vivienda",
"anuncios": []
},
"slug": "vendo-casa",
"created": "2018-01-22T21:40:28+0100",
"updated": "2018-01-22T21:40:28+0100"
},
{
"id": 4,
"titulo": "Vendo SmarTV",
"descripccion": "wefwef",
"precio": 120,
"nombre": "JJJJJ",
"telefono": "XXXXXX",
"auto": false,
"categoria": {
"id": 3,
"nombre": "Computadoras",
"slug": "computadoras",
"anuncios": [
{
"id": 2,
"titulo": "Venta de monitor",
"descripccion": "ssasas",
"precio": 80,
"nombre": "JJJJJ",
"telefono": "XXXXXX",
"auto": false,
"slug": "xxxxx",
"created": "2018-01-22T21:26:55+0100",
"updated": "2018-01-22T21:40:43+0100",
"image_name": "25UM58_7_170914.jpg"
}
]
},
"slug": "vendo-smartv",
"created": "2018-01-22T23:48:37+0100",
"updated": "2018-01-22T23:48:37+0100",
"image_name": "132124646_1GG.jpg",
"image1_name": "132124646_3GG.jpg"
}
]
How can I solve this?
Greetings