Source of file TestDataObject.php
Size: 1,738 Bytes - Last Modified: 2021-12-23T11:00:27+00:00
/var/www/docs.ssmods.com/process/src/tests/TestDataObject.php
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283 | <?php namespace g4b0\SearchableDataObjects\Tests; use g4b0\SearchableDataObjects\Searchable; use SilverStripe\Dev\TestOnly; use SilverStripe\ORM\DataObject; /** * Test DataObject */ class TestDataObject extends DataObject implements TestOnly, Searchable { private static $db = array( 'Title' => 'Varchar', 'Subtitle' => 'Varchar', 'Content' => 'HTMLText', ); private static $table_name = 'TestDataObject'; /** * Link to this DO * @return string */ public function Link() { return $this->Page()->Link() . 'read/' . $this->ID; } /** * Filter array * eg. array('Disabled' => 0); * @return array */ public static function getSearchFilter() { return array(); } /** * FilterAny array (optional) * eg. array('Disabled' => 0, 'Override' => 1); * @return array */ public static function getSearchFilterAny() { return array(); } /** * FilterByCallback function (optional) * eg. function($object){ * return ($object->StartDate > date('Y-m-d') || $object->isStillRecurring()); * }; * @return array */ // public static function getSearchFilterByCallback() // { // return function($object){ return true; }; // } /** * Fields that compose the Title * eg. array('Title', 'Subtitle'); * @return array */ public function getTitleFields() { return array('Title'); } /** * Fields that compose the Content * eg. array('Teaser', 'Content'); * @return array */ public function getContentFields() { return array('Subtitle', 'Content'); } } |