| 1 | <?php |
||
| 2 | |||
| 3 | namespace Cube\SilverStripe\Validation\Tests\Stub; |
||
| 4 | |||
| 5 | use SilverStripe\Dev\TestOnly; |
||
| 6 | use SilverStripe\ORM\DataObject; |
||
| 7 | use Cube\SilverStripe\Validation\Interfaces\ValidationRules; |
||
| 8 | |||
| 9 | /** |
||
| 10 | * Class Customer |
||
| 11 | * @package Cube\SilverStripe\Validation\Tests\Stub |
||
| 12 | */ |
||
| 13 | class Customer extends DataObject implements TestOnly, ValidationRules |
||
| 14 | { |
||
| 15 | /** |
||
| 16 | * @var string[] |
||
| 17 | */ |
||
| 18 | private static $db = [ |
||
|
0 ignored issues
–
show
introduced
by
Loading history...
|
|||
| 19 | 'Name' => 'Varchar(255)', |
||
| 20 | 'Company' => 'Varchar(255)' |
||
| 21 | ]; |
||
| 22 | |||
| 23 | /** |
||
| 24 | * @return array |
||
| 25 | */ |
||
| 26 | public function rules() : array |
||
| 27 | { |
||
| 28 | return [ |
||
| 29 | 'Name' => 'required', |
||
| 30 | 'Company' => 'required' |
||
| 31 | ]; |
||
| 32 | } |
||
| 33 | |||
| 34 | /** |
||
| 35 | * @return string[][] |
||
| 36 | */ |
||
| 37 | public function messages() : array |
||
| 38 | { |
||
| 39 | return [ |
||
| 40 | 'Company' => [ |
||
| 41 | 'required' => 'You need to work at a company.' |
||
| 42 | ] |
||
| 43 | ]; |
||
| 44 | } |
||
| 45 | } |
||
| 46 |