Database relationships and mappers/entities


I am currently developing an app for Nextcloud. I use two tables in the database whose entries are related to each other. In my API controller I want to return data which nests rows of one table into rows of the other. The problem is that the database mappers return entities which cannot be combined or altered. Unfortunately I cannot find anything useful in the documentation regarding database relationships.

Can somebody please point out to me how to create a custom DataResponse where I can combine data from the two different database entities?

Thank you in advance!