How can I get a list of all classes extended by a DataExtension?
g4b0
This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.
Please use forum.silverstripe.org for any new questions
(announcement).
The forum archive will stick around, but will be read only.
You can also use our Slack channel
or StackOverflow to ask for help.
Check out our community overview for more options to contribute.
How can I get a list of all classes extended by a DataExtension?
g4b0
Going that way might be tricky Object::has_extension($class, $extension) would be one piece of API that would help, though you would need to get a list of classes though. ClassInfo::subclassesFor('DataObject') will give you an array of dataobject classes so you could use both
foreach(ClassInfo::subclassesFor('DataObject') as $className) {
if(Object::has_extension($className, 'YourExtension')) {
// class has extension
}
}
I solved with:
foreach(ClassInfo::subclassesFor('DataObject') as $class ) {
if (singleton($class)->hasExtension("ZkTwitterExtension")) {
Do you think your version is more performat, or they're the same?