Full reproduction of M:N pivot table issue #6
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary of Operations
1. Creating an Account and User:
Account
andUser
are created.2. Creating a Project and Assigning a User:
Project
is created with the name 'My First Project'.AccountUser
) between the user and account is fetched.AccountUser
is found, the project is assigned to thisAccountUser
.3. Creating Documents and Assigning Them:
Document
objects are created and associated with the previously created account.AccountUser
) is refetched, and specific relations (assignedProjects
,assignedDocuments
) are populated.Entity Relationships
AccountUser
account
(Account) - Represents the many-to-one relationship withAccount
.user
(User) - Represents the many-to-one relationship withUser
, with cascade updates.assignedDocuments
(Document) - Represents the one-to-many relationship withDocument
, where theDocument
entity refers to thisAccountUser
asassignee
.assignedProjects
(Project) - Represents the many-to-many relationship withProject
.Account
id
- A unique identifier for the account.users
(User) - Represents the many-to-many relationship withUser
, usingAccountUser
as the pivot entity.projects
(Project) - Represents the one-to-many relationship withProject
.Document
id
- A unique identifier for the document.project
(Project) - Represents the many-to-one relationship withProject
.account
(Account) - Represents the many-to-one relationship withAccount
.assignee
(AccountUser) - Represents the many-to-one relationship withAccountUser
, indicating the document's assignee.Project
id
- A unique identifier for the project.name
- The name of the project.account
(Account) - Represents the many-to-one relationship withAccount
.documents
(Document) - Represents the one-to-many relationship withDocument
, where theDocument
entity refers to thisProject
.assignedUsers
(AccountUser) - Represents the many-to-many relationship withAccountUser
, indicating users assigned to the project.User
id
- A unique identifier for the user.email
- The unique email address of the user.accounts
(Account) - Represents the many-to-many relationship withAccount
, mapped by theusers
property inAccount
.Relationship Summary
AccountUser
pivot entity.