Hey guys,
i´ve a question.
I´ve got a many to many relationship: One Category can have many news pages and a news page can have several categories
i´ve basically the following peace of code
return DataObject::get(
$obj="NewsPage",
$filter = "Category.Title = 'Test',
$sort="",
$join= "LEFT JOIN NewsPage_Categories ON NewsPage_Categories.NewsPageID = $this->ID
LEFT JOIN Category ON Category.ID = NewsPage_Categories.CategoryID",
$limit="{$SQL_start},{$limit}"
);
}
The result doesn´t show one object ALTHOUGH there is a Category with the Title "Element".
For example if I use for the filter the following $filter = "Headline = 'Test Headline'" a result is shown.
I have the opinion that the filter variable does ONLY accept the table defined in $obj.. in this case "NewsPage".
But i need this double join to combine the three tables of the many-to-many relationsship and do a filter in the CATEGORY table and NOT the newsPage table.
Does anyone have an idea? Is this possible in silverstripe?
Thanx in advance,
sash