silverstripe /
silverstripe-restfulserver
| 1 | <?php |
||
| 2 | |||
| 3 | namespace SilverStripe\RestfulServer\Tests\Stubs; |
||
| 4 | |||
| 5 | use SilverStripe\Dev\TestOnly; |
||
| 6 | use SilverStripe\ORM\DataObject; |
||
| 7 | |||
| 8 | /** |
||
| 9 | * Class RestfulServerTestExceptionThrown |
||
| 10 | * @package SilverStripe\RestfulServer\Tests\Stubs |
||
| 11 | * |
||
| 12 | * @property string Content |
||
| 13 | * @property string Title |
||
| 14 | */ |
||
| 15 | class RestfulServerTestExceptionThrown extends DataObject implements TestOnly |
||
| 16 | { |
||
| 17 | private static $api_access = true; |
||
|
0 ignored issues
–
show
introduced
by
Loading history...
|
|||
| 18 | |||
| 19 | private static $table_name = 'RestfulServerTestExceptionThrown'; |
||
|
0 ignored issues
–
show
|
|||
| 20 | |||
| 21 | private static $db = array( |
||
|
0 ignored issues
–
show
|
|||
| 22 | 'Content' => 'Text', |
||
| 23 | 'Title' => 'Text', |
||
| 24 | ); |
||
| 25 | |||
| 26 | public function onBeforeWrite() |
||
| 27 | { |
||
| 28 | parent::onBeforeWrite(); |
||
| 29 | |||
| 30 | throw new \Exception('This is an exception test'); |
||
| 31 | } |
||
| 32 | |||
| 33 | public function canView($member = null) |
||
| 34 | { |
||
| 35 | return true; |
||
| 36 | } |
||
| 37 | |||
| 38 | public function canEdit($member = null) |
||
| 39 | { |
||
| 40 | return true; |
||
| 41 | } |
||
| 42 | |||
| 43 | public function canDelete($member = null) |
||
| 44 | { |
||
| 45 | return true; |
||
| 46 | } |
||
| 47 | |||
| 48 | public function canCreate($member = null, $context = array()) |
||
| 49 | { |
||
| 50 | return true; |
||
| 51 | } |
||
| 52 | } |
||
| 53 |