Completed
Push — master ( 3596b1...186b3d )
by Oscar
03:58
created

Articles   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
lcom 1
cbo 2
dl 0
loc 37
rs 10
c 1
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getBasePath() 0 4 1
B getScheme() 0 29 1
1
<?php
2
3
namespace Demo\Entities;
4
5
use Folk\Entities\Yaml;
6
use FormManager\Builder;
7
use FormManager\InvalidValueException;
8
9
class Articles extends Yaml
10
{
11
    protected function getBasePath()
12
    {
13
        return __DIR__.'/yaml';
14
    }
15
16
    public function getScheme(Builder $builder)
17
    {
18
        return $builder->group([
19
            'title' => $builder->text()
20
                ->label('Title'),
21
22
            'intro' => $builder->html()
23
                ->label('Introduction'),
24
25
            'tags' => $builder->relationMany($this->admin->getEntity('tags'))
26
                ->allowNewValues()
27
                ->data('config', [
28
                    'create' => 'name'
29
                ])
30
                ->label('Tags'),
31
32
            'category' => $builder->select()
33
                ->options([
34
                    'food' => 'Food',
35
                    'sports' => 'Sports',
36
                    'life' => 'Life',
37
                ])
38
                ->label('Category'),
39
40
            'actived' => $builder->checkbox()
41
                ->set('editable', true)
42
                ->label('Actived'),
43
        ]);
44
    }
45
}
46