1 | <?php |
||
20 | class FooSchema extends Schema |
||
21 | { |
||
22 | public function schema() |
||
23 | { |
||
24 | return [ |
||
25 | '_id' => [ |
||
26 | 'unique' => true, |
||
27 | 'default' => function () { |
||
28 | return (new Uuid)->generate(); |
||
29 | }, |
||
30 | 'validator' => [ |
||
31 | 'class' => StringValidator::class, |
||
32 | ] |
||
33 | ], |
||
34 | 'title' => [ |
||
35 | 'unique' => true, |
||
36 | 'required' => true, |
||
37 | 'validator' => [ |
||
38 | 'class' => StringValidator::class, |
||
39 | 'params' => [ |
||
40 | 'maxLength' => 100, |
||
41 | ], |
||
42 | ], |
||
43 | ], |
||
44 | 'status' => [ |
||
45 | 'default' => 0, |
||
46 | 'validator' => [ |
||
47 | 'class' => IntegerValidator::class, |
||
48 | 'params' => [ |
||
49 | 'min' => 0, |
||
50 | 'max' => 1, |
||
51 | ], |
||
52 | ], |
||
53 | ], |
||
54 | 'bar' => [ |
||
55 | 'type' => BarSchema::class, |
||
56 | ], |
||
57 | ]; |
||
58 | } |
||
59 | } |
||
60 |