Dynamic relation load #24143
-
QuestionHi, we can use the Proxy class in javascript Currently I use Eloquent ORM in PHP and it's i VERY helpful Can we implement it in prisma? Have a nice day How to reproduce (optional)No response Expected behavior (optional)New solution would be like below: Information about Prisma Schema, Client Queries and Environment (optional)No response |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Hi @simplo-marcind 👋 Prisma indeed requires you to specify the relations you want to include when fetching data from the database. As for your question about implementing a feature similar to Eloquent ORM's automatic resolution of inverse relationships, as of now, Prisma does not support this feature. In Prisma, you need to explicitly define the relations in your schema and also specify them in your queries. However, if you want to see this implemented, you need to open a feature request detailing your usecase so that our engineers can take a look. |
Beta Was this translation helpful? Give feedback.
-
HI @ludralph |
Beta Was this translation helpful? Give feedback.
Hi @simplo-marcind 👋
Prisma indeed requires you to specify the relations you want to include when fetching data from the database. As for your question about implementing a feature similar to Eloquent ORM's automatic resolution of inverse relationships, as of now, Prisma does not support this feature. In Prisma, you need to explicitly define the relations in your schema and also specify them in your queries.
However, if you want to see this implemented, you need to open a feature request detailing your usecase so that our engineers can take a look.