Created
February 12, 2011 09:02
-
-
Save stojg/823631 to your computer and use it in GitHub Desktop.
An example on how to add indexes on silverstripe dataobjects
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?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)', | |
| ) | |
| ); | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?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