Q
Q
Qwyu_4iLofK2022-01-18 21:59:45
Doctrine ORM
Qwyu_4iLofK, 2022-01-18 21:59:45

By means of the doctrine it is possible to make summaries at 2 references of the table to itself, on one field id?

There is a table p
p.id
p.name needs to be

made like a new table pp2
pid (reference to p.id many to many) ppid (reference to p.id many to many)

itself, and we got a new table)? if not, then I will create a pp2 entity.

That is, it should be
Table p:
id | name
1 | Fruit
2 | Orange
3 | Apple
4 | Vegetable
5 | Potato
6 | Cabbage

Table pp2
pid | ppid1
| 2
1 | 3
4 | 5
4 | 6

Answer the question

In order to leave comments, you need to log in

1 answer(s)
T
tukreb, 2022-01-19
@tukreb

You cannot refer to the same field in the same table.
What you tried to describe is called Adjacency List (but you need to use an additional parent_id field)
And what you depicted as 2 tables is called Subsets. I
recommend that you familiarize yourself with these concepts and choose what you need.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question