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

feat: add missing createRoles association method for HasMany relationship #17161

Closed
wants to merge 9 commits into from

Conversation

sakupan102
Copy link

@sakupan102 sakupan102 commented Mar 13, 2024

Pull Request Checklist

  • Have you added new tests to prevent regressions?
  • If a documentation update is necessary, have you opened a PR to the documentation repository?
  • Did you update the typescript typings accordingly (if applicable)?
  • Does the description below contain a link to an existing issue (Closes #[issue]) or a description of the issue you are solving?
  • Does the name of your PR follow our conventions?

Description of Changes

  • Added new method createMultiple to create multiple associated instances.
    Example use case:
class Article extends Model:
  declare: id: number;
  @HasMany(() => Label, 'articleId')
  declare createLabels: HasManyCreateAssociationMixin<Label>
class Label extends Model:
  declare id: number;
  declare articleId: number

const article = await Article.create();
const labels = await article.createLabels([{id: 100}, {id: 200}])
// created two instances

this PR closes #11372

@sakupan102 sakupan102 requested a review from a team as a code owner March 13, 2024 10:47
@sakupan102
Copy link
Author

This pull request includes another commit, so I will close this pull request and create a new one.

@sakupan102 sakupan102 closed this Mar 13, 2024
@sakupan102 sakupan102 deleted the feature/has-many branch March 13, 2024 17:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Adding missing createRoles association method for HasMany relationship
1 participant