Hi.
Someone probably solved this before, but I failed at searching the forum for this.
Let's have a look at this piece of code:
class MyObject extends DataObject {
private static $has_many = array(
'Objects' => 'CommonObject',
);
}
class MyPage extends Page {
private static $has_many = array(
'Objects' => 'CommonObject',
);
}
class CommonObject extends DataObject {
private static $has_one = array(
'Parent' => 'DataObject',
);
}
in simpler words, what I'm trying to achieve, is to have a DataObject that can act as a child in one-to-many relation, having a Page OR a DataObject as a Parent.
But declaring:
private static $has_one = array(
'Parent' => 'DataObject',
);
gives me the following error:
DataList::create Can't find data classes (classes linked to tables) for DataObject
and it is true, as DataObject does not have a separate table in database, as it doesn't have any fields itself.
How do I achieve this?
Many thaks.