Test Failed
Pull Request — master (#52)
by Rafael
05:00
created

CustomFieldsController   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
eloc 10
dl 0
loc 31
ccs 0
cts 9
cp 0
rs 10
c 0
b 0
f 0
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A onConstruct() 0 10 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Gewaer\Api\Controllers;
6
7
use Gewaer\CustomFields\CustomFields;
8
9
/**
10
 * Class LanguagesController
11
 *
12
 * @package Gewaer\Api\Controllers
13
 * @property Users $userData
14
 * @property Apps $app
15
 *
16
 */
17
class CustomFieldsController extends BaseController
18
{
19
    /*
20
     * fields we accept to create
21
     *
22
     * @var array
23
     */
24
    protected $createFields = ['name', 'custom_fields_modules_id', 'fields_type_id'];
25
26
    /*
27
     * fields we accept to create
28
     *
29
     * @var array
30
     */
31
    protected $updateFields = ['name', 'custom_fields_modules_id', 'fields_type_id'];
32
33
    /**
34
     * set objects
35
     *
36
     * @return void
37
     */
38
    public function onConstruct()
39
    {
40
        $this->model = new CustomFields();
41
        $this->model->users_id = $this->userData->getId();
42
        $this->model->companies_id = $this->userData->currentCompanyId();
43
        $this->model->apps_id = $this->app->getId();
44
45
        $this->additionalSearchFields = [
46
            ['apps_id', ':', $this->app->getId()],
47
            ['companies_id', ':', $this->userData->currentCompanyId()],
48
        ];
49
    }
50
}
51