Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

how do I add attributes to a many-many relationship?


Go to End


3 Posts   819 Views

Avatar
johnofjack

Community Member, 22 Posts

22 October 2011 at 7:47am

I have a many-many relationship between BookPage and AuthorPage. That's working well enough--I can add authors to books; books appear on author pages; authors are listed on their book pages.

I need to add an attribute to some of the authorships, but not to the authors themselves (someone might be the author of one book, the editor of another, the illustrator of a third).

Authors are coming in on a checklist in the CMS when looking at a BookPage. What I'd like is to have a dropdown menu beside each one where you'd select the role each author played.

I tried adding Roles to the Authors tab on BookPage, but couldn't get it to show up by each author; instead it showed up once at the bottom.

I'm probably going about this wrong. What is the best way to do this?

Avatar
swaiba

Forum Moderator, 1899 Posts

23 October 2011 at 12:52am

Hi John,

Welcome to the forums,

I've never done this, but you might want to search and read around "many_many_extraFields" this seems to be to do with what you are asking.

Barry

Avatar
johnofjack

Community Member, 22 Posts

29 October 2011 at 12:35pm

Thanks, swaiba. I'll look into that some more; right now I'm having a bit of trouble wrapping my head around it, so I've moved onto other things. That *does* look like it could do what I need, though.