Hi all,
I've been busy with this little gem for a while now and can't find any leads anywhere, so I'm hoping someone can point me in the right direction. In a ProductPage_Controller class I have the following custom function:
function OtherProducts() {
return DataObject::get("ProductPage", "ParentID = {$this->ParentID} AND ProductPage.ID!={$this->ID}", "Created ASC", "","5");
}
This returns all ProductPages under the current parent excluding the current page (in other words: all _other_ pages under this parent).
The problem is that ProductPage.ID, of course, gives an error (unknown column) when working with Live data, because it should be ProductPage_Live.ID. I can't find any way to (preferably) stick a variable in it so it can determine auto-magically whether it should be ProductPage or ProductPage_Live table.
P.S. I can't just make it ID!={$this->ID} because then it throws an error that the ID field is ambiguous....