HasManySettingsPlugin   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 1
eloc 18
dl 0
loc 24
rs 10
c 1
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A getRelations() 0 19 1
1
<?php
2
/**
3
 * Created by PhpStorm.
4
 * User: execut
5
 * Date: 12/18/17
6
 * Time: 6:00 PM
7
 */
8
9
namespace execut\import\crudFields;
10
11
12
use execut\crudFields\Plugin;
13
use execut\import\models\Setting;
14
15
class HasManySettingsPlugin extends Plugin
16
{
17
    public $attribute = null;
18
    public $relationName = null;
19
    public $relationModelClass = null;
20
    public function getRelations()
21
    {
22
        return [
23
            'importSettings' => [
24
                'class' => Setting::class,
25
                'link' => [
26
                    'id' => 'import_setting_id',
27
                ],
28
                'via' => $this->relationName,
29
                'name' => 'importSettings',
30
                'multiple' => true,
31
            ],
32
            $this->relationName => [
33
                'class' => $this->relationModelClass,
34
                'link' => [
35
                    $this->attribute => 'id',
36
                ],
37
                'name' => $this->relationName,
38
                'multiple' => true,
39
            ],
40
        ];
41
    }
42
}