HasManySettingsPlugin::getRelations()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 19
Code Lines 14

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 14
dl 0
loc 19
rs 9.7998
c 1
b 0
f 0
cc 1
nc 1
nop 0
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
}