M
M
Maxim Lagoysky2019-06-12 15:26:39
symfony
Maxim Lagoysky, 2019-06-12 15:26:39

How to get one object if the table is connecting(ManyToMany)?

Hello everyone, I have a question. I have 3 tables with a ManyToMany relationship. Tables Page, Role, PageAccess. The PageAccess linking table has the fields role_id, page_id, visible. The role_id and page_id fields are a composite primary key. When I select one page from the Page table with a query, I would like to have a method in which, for example, I could pass $role_id and get one PageAccess object as a result. How can I do that? Is it necessary to somehow describe the OneToOne relationship in the Page table? Or is it just a way to write something?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question