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

Can't create model with related model #1269

Closed
cajoy opened this issue Apr 21, 2018 · 3 comments
Closed

Can't create model with related model #1269

cajoy opened this issue Apr 21, 2018 · 3 comments

Comments

@cajoy
Copy link

cajoy commented Apr 21, 2018

Description / Steps to reproduce / Feature proposal

I would like to create model with related model/s . but can't

const feature = await this.featureRepository.findOne({
      where: {
        name: 'Book'
      }
})

const model = await this.repository.create({name: 'test', features: [feature]})

Current Behavior

Getting following error:

Unhandled rejection TypeError: Class constructor Feature cannot be invoked without 'new'

How can I create model with related model? I can't find any example for that

@jannyHou
Copy link
Contributor

Hi @cajoy the relation implementation in loopback-next is still in progress, see our spike story in: #995

@cajoy
Copy link
Author

cajoy commented Apr 22, 2018

Thank you @jannyHou, that explains

@jannyHou
Copy link
Contributor

@cajoy you are welcome! I am closing this issue and let's use #995 to track the progress & everyone's option. We can continue the discussion there.
Feel free to reopen this one if you have other questions!

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

No branches or pull requests

2 participants