7913 Posts in 1355 Topics by 930 members
DataObjectManager Module
SilverStripe Forums » DataObjectManager Module » Different DOM's for subtypes of type
Discuss the DataObjectManager module, and the related ImageGallery module.
Moderators: martimiz, UncleCheese, Howard, Sean, Ryan M., biapar, Willr, Ingo, swaiba, simon_w
|
Page:
1
|
Go to End | |
| Author | Topic: | 548 Views |
-
Different DOM's for subtypes of type

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).
-
Re: Different DOM's for subtypes of type

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 FooDOM should allow the creation of Bar and Baz objects for the has_many relation.
Is such a thing possible?
-
Re: Different DOM's for subtypes of type

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.
| 548 Views | ||
|
Page:
1
|
Go to Top |


