OnBeforeIBlockPropertyDelete::getTemplate()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
namespace Arrilot\BitrixMigrations\Autocreate\Handlers;
4
5
use CIBlockProperty;
6
7
class OnBeforeIBlockPropertyDelete extends BaseHandler implements HandlerInterface
8
{
9
    /**
10
     * Constructor.
11
     *
12
     * @param array $params
13
     */
14
    public function __construct($params)
15
    {
16
        $this->fields = CIBlockProperty::getByID($params[0])->fetch();
17
    }
18
19
    /**
20
     * Get migration name.
21
     *
22
     * @return string
23
     */
24
    public function getName()
25
    {
26
        return "auto_delete_iblock_element_property_{$this->fields['CODE']}_in_ib_{$this->fields['IBLOCK_ID']}";
27
    }
28
29
    /**
30
     * Get template name.
31
     *
32
     * @return string
33
     */
34
    public function getTemplate()
35
    {
36
        return 'auto_delete_iblock_element_property';
37
    }
38
39
    /**
40
     * Get array of placeholders to replace.
41
     *
42
     * @return array
43
     */
44
    public function getReplace()
45
    {
46
        return [
47
            'iblockId' => $this->fields['IBLOCK_ID'],
48
            'code'     => "'".$this->fields['CODE']."'",
49
        ];
50
    }
51
}
52