B
B
BonBon Slick2021-04-02 01:02:57
Doctrine ORM
BonBon Slick, 2021-04-02 01:02:57

What's the point of unique in join-columns with ManyToMany?

<many-to-many target-entity="App\Domain\AccessControlListPack\Role\Entity\Role"
                      field="roles"
                      inversed-by="features"
                      index-by="uuid"
        >
            <cascade>
                <cascade-persist/>
            </cascade>
            <join-table name="roles_features">
                <join-columns>
                    <join-column name="feature_uuid" 
referenced-column-name="uuid" 
nullable="false" 
unique="false"
/>
                </join-columns>
                <inverse-join-columns>
                    <join-column name="role_uuid" referenced-column-name="uuid"/>
                </inverse-join-columns>
            </join-table>
        </many-to-many>

This makes the entry unique in the pivot table, which makes a ManyToOne relationship where Many is Roles to Features.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
B
BoShurik, 2021-04-02
@BonBonSlick

Yes, this is a one-to-many simulation
https://www.doctrine-project.org/projects/doctrine...
May be useful when communication on the other side is not needed

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question