Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BelongsToUnique #3

Open
Noogic opened this issue Oct 18, 2018 · 0 comments
Open

BelongsToUnique #3

Noogic opened this issue Oct 18, 2018 · 0 comments
Labels
enhancement New feature or request

Comments

@Noogic
Copy link
Owner

Noogic commented Oct 18, 2018

When an instance is being created, all its relations defined in the belongsTo attribute are handled before the instance is created.

To handle that, the related instance is created and its id is stored. The result with this approach is the reuse of the related instance.

For example, if a Post belongs to a User and you create 5 instances with the PostBuilder, it first create one user and then assign it to all the 5 posts... and this is the desired behaviour, unless the relation must be unique.

For example, if a user must have one (and only one) account, the AccountBuilder must create one user for each account being created

@Noogic Noogic added the enhancement New feature or request label Oct 18, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant