Failed Conditions
Push — master ( 55bfad...b74acd )
by Maximo
02:48
created

CustomFieldsController::onConstruct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 8
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 7
nc 1
nop 0
dl 0
loc 10
ccs 8
cts 8
cp 1
crap 1
rs 10
c 0
b 0
f 0
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 3
    public function onConstruct()
39
    {
40 3
        $this->model = new CustomFields();
41 3
        $this->model->users_id = $this->userData->getId();
42 3
        $this->model->companies_id = $this->userData->default_company;
43 3
        $this->model->apps_id = $this->app->getId();
44
45 3
        $this->additionalSearchFields = [
46 3
            ['apps_id', ':', $this->app->getId()],
47 3
            ['companies_id', ':', $this->userData->default_company],
48
        ];
49 3
    }
50
}
51