7939 Posts in 1472 Topics by 944 members
|Go to End|
9 March 2011 at 5:43am
I have a class Foo (extending DataObject). A certain page type has_many Foo. I don't actually use objects of type Foo but only subtypes (inherited classes) RedFoo, BlueFoo and GreenFoo.
I want to have a DOM for each of these inherited Foo's ( DOM(RedFoo), DOM(BlueFoo), DOM(GreenFoo) ) but I don't want to have 3 has_many relations in the page. Is this possible?
I know you can pass a $sourceFilter to the constructor of the DOM so I could filter the specific Foo type I want for each DOM, but the DOM wouldn't be aware of what kind of Foo's he's managing. And it is important that each DOM know what kind of Foo he uses because they have different fields (e.g. one has an image field, another a text field).
The reason to have it this way is because in the frontend I want to treat all Foo's the same (with specific display mechanisms).
30 March 2011 at 6:39am
I'm interested in something similar to this. I'd like the DOM to allow me to create objects that are sub types of Foo. In other words:
Page has_many Foo
Bar extends Foo
Baz extends Foo
DOM should allow the creation of Bar and Baz objects for the has_many relation.
Is such a thing possible?
30 March 2011 at 7:42am
I had to create 3 differente DOM's and 3 has_many relations. Maybe I just didn't find the solution but to me it looks like it is not possible.
|Go to Top|