Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
An example on how to add indexes on silverstripe dataobjects
<?php
class SiteTreeOptimizationDecorator extends DataObjectDecorator {
public function extraStatics() {
return array(
'indexes' => array(
// Will help when fetching menu's
'showinmenus_sort' => '(ShowInMenus,Sort)',
// Will help when fetching a page from sitetree
'urlsegment_sort' => '(URLSegment,Sort)',
)
);
}
}
<?php
class WidgetOptimizationDecorator extends DataObjectDecorator {
public function extraStatics() {
return array(
'indexes' => array(
// Will help when fetching widget
'parentid_sort' => '(ParentID,Sort)',
)
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.