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

Many to many: How to access relation properties? #466

Closed
pfirpfel opened this issue Mar 7, 2014 · 4 comments
Closed

Many to many: How to access relation properties? #466

pfirpfel opened this issue Mar 7, 2014 · 4 comments
Milestone

Comments

@pfirpfel
Copy link

pfirpfel commented Mar 7, 2014

Hello there!

From: https://github.com/dresende/node-orm2#hasmany

Patient.hasMany('doctors', Doctor, { why: String }, { reverse: 'patients' });
Patient.sync();

[...]

patient.addDoctor(surgeon, {why: "remove appendix"}, function(err) {} )

How could I access the 'why'-property in this case? I can't seem to find it in the documentation.

Thanks for your help!

@dxg
Copy link
Collaborator

dxg commented Mar 13, 2014

Is this what you're looking for?

@pfirpfel
Copy link
Author

Yes, it was. But it seems, that 'extras' with the type Object won't work. Only if I manually stringify/parse the object, I was able to save and retrieve it.

@dxg dxg closed this as completed in 7f3aa4f Mar 13, 2014
@dxg dxg added this to the v2.1.4 milestone Mar 13, 2014
@dxg
Copy link
Collaborator

dxg commented Mar 13, 2014

The conversion code was missing from has many. It's fixed now on master.
New orm version will be out soon.

@pfirpfel
Copy link
Author

Thank you!

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