2580 Posts in 695 Topics by 540 members
Data Model Questions
SilverStripe Forums » Data Model Questions » Creating has_many relation with self
Moderators: martimiz, Howard, Sean, Ryan M., biapar, Willr, Ingo, swaiba
|
Page:
1
|
Go to End | |
| Author | Topic: | 1409 Views |
-
Creating has_many relation with self

11 January 2010 at 12:11pm
Can a dataobject have a has_many relation with self. I'm trying to set up a list of definitions, then include related terms. So each term would have to have a has_many relation with other terms.
-
Re: Creating has_many relation with self

11 January 2010 at 1:16pm
I think you would need a many_many relationship for that as a Definition would have many Related Terms and each of those Related terms would probably have multiple definition it relates to.
You can try add a many_many / belongs_many_many to the object and try it out. I think it *should* be fine with a many_many relationship on itself. Try it out and see what happens
-
Re: Creating has_many relation with self

18 January 2010 at 8:36am
From IRC:
michaelcole: Hello!
michaelcole: I'm just checking out Silverstripe. How could I model a "has many reference to self" relationship with the ORM?
simon_w: static $has_many = array ('LotsOfMe'=>__CLASS__); static $has_one = array('OneOfMe' => __CLASS__);
michaelcole: Cool! Sounds simple. I like it!
| 1409 Views | ||
|
Page:
1
|
Go to Top |


