21309 Posts in 5738 Topics by 2603 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 852 Views |
-
many_many relation in same table?

27 December 2009 at 6:30pm Last edited: 27 December 2009 6:32pm
Can any1 explain how i can create a working many_many relation using only one table, ie
One Article should be able to hold many other articlesclass Article {
static $many_many = array("NewsArticles"=>"Article");function getCMSFields() {
$fields = parent::getCMSFields();
$table = new ManyManyComplexTableField(
$this,
'NewsArticles',
'Article'
);$fields->addFieldToTab("Root.Content.Related Articles",$table);
return $fields;
};the available articles are displayed in the table, but if i check the checkbox and
saves the page, the relation isnt saved -
Re: many_many relation in same table?

27 December 2009 at 10:52pm Last edited: 27 December 2009 10:57pm
A many_many relation always needs a third table in SilverStripe. Your code has a big error anyways. Your class Article has a relation to itself. That´s not possible, nor logical.
| 852 Views | ||
|
Page:
1
|
Go to Top |

