Plugin::getRequiredAttributesByTypes()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 4
dl 0
loc 5
rs 10
c 1
b 0
f 1
cc 1
nc 1
nop 0
1
<?php
2
/**
3
 * Created by PhpStorm.
4
 * User: execut
5
 * Date: 12/19/17
6
 * Time: 5:51 PM
7
 */
8
9
namespace execut\import\example\simple;
10
11
12
use execut\import\example\models\ProductSimple;
13
use execut\import\models\File;
14
use execut\navigation\Component;
15
16
class Plugin implements \execut\import\Plugin
17
{
18
    public function getDictionaries() {
19
        return [
20
            'example_product_id' => ProductSimple::find()
21
        ];
22
    }
23
24
    /**
25
     * Возвращает настройки парсеров моделей
26
     *
27
     * @return array
28
     */
29
    public function getParsersByTypesSettings() {
30
        $queries = $this->getDictionaries();
31
        return [
32
            'example_product_id' => [
33
                'example_product_id' => [
34
                    'isImport' => true,
35
                    'isDelete' => true,
36
                    'query' => $queries['example_product_id'],
37
                    'attributes' => [
38
                        'name' => [
39
                            'key' => 'name',
40
                            'isFind' => true,
41
                        ],
42
                        'price' => [
43
                            'key' => 'price',
44
                            'isFind' => false,
45
                        ],
46
                    ],
47
                ],
48
            ],
49
        ];
50
    }
51
52
    public function getAttributesSetsTypesList() {
53
        return [
54
            'example_product_id' => 'Product',
55
        ];
56
    }
57
58
    public function getAttributesValuesTypesList() {
59
        return [
60
            'example_product_id.price' => 'Product price',
61
            'example_product_id.name' => 'Product name',
62
        ];
63
    }
64
65
    public function getRequiredAttributesByTypes() {
66
        return [
67
            'example_product_id' => [
68
                'example_product_id.name',
69
                'example_product_id.price',
70
            ],
71
        ];
72
    }
73
74
    /**
75
     * Удаляет привязанные к файлу импорта записи
76
     */
77
    public function getOldIdsByFile(File $importFile)
78
    {
79
        return ProductSimple::find()->select('id')->column();
80
    }
81
82
    public function getAllowedRoles() {
83
        return [];
84
    }
85
86
    public function getFilesCrudFieldsPlugins() {
87
    }
88
89
    public function getSettingsCrudFieldsPlugins() {
90
    }
91
92
    public function getSettingsSheetsCrudFieldsPlugins() {
93
    }
94
95
    public function bootstrapNavigation(Component $navigation) {
96
    }
97
}