| Total Complexity | 5 |
| Total Lines | 54 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 0 | ||
| 1 | <?php |
||
| 19 | class Form extends \roaresearch\yii2\rmdb\models\Entity |
||
| 20 | { |
||
| 21 | /** |
||
| 22 | * @var string full class name of the model used in the relation |
||
| 23 | * `getSections()`. |
||
| 24 | */ |
||
| 25 | protected $sectionClass = Section::class; |
||
| 26 | 32 | ||
| 27 | /** |
||
| 28 | 32 | * @inheritdoc |
|
| 29 | */ |
||
| 30 | public static function tableName() |
||
| 31 | { |
||
| 32 | return '{{%formgenerator_form}}'; |
||
| 33 | } |
||
| 34 | 27 | ||
| 35 | /** |
||
| 36 | 27 | * @inheritdoc |
|
| 37 | */ |
||
| 38 | protected function attributeTypecast(): array |
||
| 39 | { |
||
| 40 | return parent::attributeTypecast() + ['id' => 'integer']; |
||
| 41 | } |
||
| 42 | 2 | ||
| 43 | /** |
||
| 44 | * @inheritdoc |
||
| 45 | 2 | */ |
|
| 46 | public function rules() |
||
| 47 | { |
||
| 48 | return [ |
||
| 49 | [['name'], 'required'], |
||
| 50 | [['name'], 'string', 'min' => 6], |
||
| 51 | [['name'], 'unique'], |
||
| 52 | ]; |
||
| 53 | } |
||
| 54 | 3 | ||
| 55 | /** |
||
| 56 | 3 | * @inheritdoc |
|
| 57 | 3 | */ |
|
| 58 | public function attributeLabels() |
||
| 59 | 3 | { |
|
| 60 | return array_merge([ |
||
| 61 | 'id' => 'ID', |
||
| 62 | 'name' => 'Form name', |
||
| 63 | ], parent::attributeLabels()); |
||
| 64 | } |
||
| 65 | 1 | ||
| 66 | /** |
||
| 67 | 1 | * @return ActiveQuery |
|
| 68 | 1 | */ |
|
| 69 | public function getSections(): ActiveQuery |
||
| 73 | } |
||
| 74 | } |
||
| 75 |