dynamic /
viewable-dataobject
| 1 | <?php |
||
| 2 | |||
| 3 | namespace Dynamic\ViewableDataObject\Test\TestOnly; |
||
| 4 | |||
| 5 | use Dynamic\ViewableDataObject\Extensions\ViewableDataObject; |
||
| 6 | use Dynamic\ViewableDataObject\VDOInterfaces\ViewableDataObjectInterface; |
||
| 7 | use SilverStripe\Dev\TestOnly; |
||
| 8 | use SilverStripe\ORM\DataObject; |
||
| 9 | |||
| 10 | class ViewableTestObject extends DataObject implements TestOnly, ViewableDataObjectInterface |
||
| 11 | { |
||
| 12 | /** |
||
| 13 | * @var array |
||
| 14 | */ |
||
| 15 | private static $db = [ |
||
|
0 ignored issues
–
show
introduced
by
Loading history...
|
|||
| 16 | 'Title' => 'Varchar(255)', |
||
| 17 | 'Content' => 'HTMLText', |
||
| 18 | ]; |
||
| 19 | |||
| 20 | /** |
||
| 21 | * @var string |
||
| 22 | */ |
||
| 23 | private static $table_name = 'ViewableTestObject'; |
||
|
0 ignored issues
–
show
|
|||
| 24 | |||
| 25 | /** |
||
| 26 | * @var array |
||
| 27 | */ |
||
| 28 | private static $extensions = [ |
||
|
0 ignored issues
–
show
|
|||
| 29 | ViewableDataObject::class, |
||
| 30 | ]; |
||
| 31 | |||
| 32 | /** |
||
| 33 | * @return DataObject |
||
| 34 | */ |
||
| 35 | public function getParentPage() |
||
| 36 | { |
||
| 37 | return \Page::get()->first(); |
||
| 38 | } |
||
| 39 | |||
| 40 | /** |
||
| 41 | * @return string |
||
| 42 | */ |
||
| 43 | public function getViewAction() |
||
| 44 | { |
||
| 45 | return 'view'; |
||
| 46 | } |
||
| 47 | } |
||
| 48 |