@@ -38,7 +38,8 @@ |
||
38 | 38 | $codeName = ucfirst($codeName); |
39 | 39 | if (file_exists(App::$primary->path . '/modules/' . $codeName . '.php')) { |
40 | 40 | Msg::add('Модуль с таким именем уже существует'); |
41 | - } else { |
|
41 | + } |
|
42 | + else { |
|
42 | 43 | $this->modules->createBlankModule(filter_input(INPUT_POST, 'name'), $codeName); |
43 | 44 | $config = App::$primary->config; |
44 | 45 | $config['modules'][] = $codeName; |
@@ -62,7 +62,8 @@ |
||
62 | 62 | $parser = new $parserName; |
63 | 63 | $parser->param = $parent; |
64 | 64 | $values = $parser->editor(); |
65 | - } else { |
|
65 | + } |
|
66 | + else { |
|
66 | 67 | $values = [ |
67 | 68 | '' => 'Выберите', |
68 | 69 | 'continue' => 'Пропустить', |
@@ -19,7 +19,8 @@ discard block |
||
19 | 19 | if (is_numeric($objectType)) { |
20 | 20 | $mapPath->object_id = $objectType; |
21 | 21 | $mapPath->type = 'object'; |
22 | - } else { |
|
22 | + } |
|
23 | + else { |
|
23 | 24 | if ($objectType == 'object') { |
24 | 25 | $object = new Migrations\Migration\Object(); |
25 | 26 | $object->model = !empty($_POST['typeOptions'][$pathId]) ? $_POST['typeOptions'][$pathId] : ''; |
@@ -28,7 +29,8 @@ discard block |
||
28 | 29 | $object->save(); |
29 | 30 | $mapPath->type = 'object'; |
30 | 31 | $mapPath->object_id = $object->id; |
31 | - } else { |
|
32 | + } |
|
33 | + else { |
|
32 | 34 | $mapPath->type = $objectType; |
33 | 35 | } |
34 | 36 | } |
@@ -48,7 +50,8 @@ discard block |
||
48 | 50 | $object->save(); |
49 | 51 | $param->type = 'object'; |
50 | 52 | $param->value = $object->id; |
51 | - } else { |
|
53 | + } |
|
54 | + else { |
|
52 | 55 | $param->type = $type; |
53 | 56 | $param->value = !empty($_POST['paramOptions'][$paramId]) ? $_POST['paramOptions'][$paramId] : ''; |
54 | 57 | } |
@@ -28,7 +28,8 @@ discard block |
||
28 | 28 | $ids[] = $id; |
29 | 29 | } |
30 | 30 | } |
31 | - } else { |
|
31 | + } |
|
32 | + else { |
|
32 | 33 | $id = $this->parseData($this->data, $preset); |
33 | 34 | if ($id) { |
34 | 35 | $ids[] = $id; |
@@ -56,10 +57,12 @@ discard block |
||
56 | 57 | $parser->parentModel = $model; |
57 | 58 | $parser->walker = $this->walker; |
58 | 59 | $parser->parse(); |
59 | - } else { |
|
60 | + } |
|
61 | + else { |
|
60 | 62 | if ($param->type == 'custom') { |
61 | 63 | $parserName = $param->value; |
62 | - } else { |
|
64 | + } |
|
65 | + else { |
|
63 | 66 | $parserName = '\Migrations\Parser\Object\\' . ucfirst($param->type); |
64 | 67 | } |
65 | 68 | $parser = new $parserName; |
@@ -105,7 +108,8 @@ discard block |
||
105 | 108 | if ($param->type == 'item_key') { |
106 | 109 | $keyCol = $param->code; |
107 | 110 | break; |
108 | - } elseif (!empty($options['unique'])) { |
|
111 | + } |
|
112 | + elseif (!empty($options['unique'])) { |
|
109 | 113 | $uniques[$param->code] = $param; |
110 | 114 | } |
111 | 115 | } |
@@ -114,7 +118,8 @@ discard block |
||
114 | 118 | if ($objectId) { |
115 | 119 | $modelName = $this->object->model; |
116 | 120 | $model = $modelName::get($objectId->object_id); |
117 | - } else { |
|
121 | + } |
|
122 | + else { |
|
118 | 123 | $model = new $this->object->model; |
119 | 124 | $model->save(['empty' => true]); |
120 | 125 | $objectId = new \Migrations\Id(); |
@@ -125,7 +130,8 @@ discard block |
||
125 | 130 | \App::$cur->migrations->ids['objectIds'][$this->object->model][$model->id] = $objectId; |
126 | 131 | \App::$cur->migrations->ids['parseIds'][$this->object->model][(string) $data[$keyCol]] = $objectId; |
127 | 132 | } |
128 | - } elseif ($uniques) { |
|
133 | + } |
|
134 | + elseif ($uniques) { |
|
129 | 135 | $where = []; |
130 | 136 | foreach ($uniques as $code => $param) { |
131 | 137 | if (!isset($data[$code])) { |
@@ -168,7 +174,8 @@ discard block |
||
168 | 174 | if (!empty($relation['type']) && $relation['type'] == 'many') { |
169 | 175 | $where[] = [$relation['col'], $this->parentModel->pk()]; |
170 | 176 | } |
171 | - } elseif ($this->parentObject) { |
|
177 | + } |
|
178 | + elseif ($this->parentObject) { |
|
172 | 179 | $modelName = $this->parentObject->object->model; |
173 | 180 | $where[] = [$modelName::index(), $this->parentModel->pk()]; |
174 | 181 | } |
@@ -23,7 +23,8 @@ discard block |
||
23 | 23 | if ($this->model) { |
24 | 24 | if ($param->type == 'custom') { |
25 | 25 | $parserName = $param->value; |
26 | - } else { |
|
26 | + } |
|
27 | + else { |
|
27 | 28 | $parserName = '\Migrations\Parser\Object\\' . ucfirst($param->type); |
28 | 29 | } |
29 | 30 | if (!\Tools::isAssoc($this->data)) { |
@@ -35,7 +36,8 @@ discard block |
||
35 | 36 | $parser->object = $this->object; |
36 | 37 | $parser->parse(); |
37 | 38 | } |
38 | - } else { |
|
39 | + } |
|
40 | + else { |
|
39 | 41 | $parser = new $parserName; |
40 | 42 | $parser->data = &$this->data[$param->code]; |
41 | 43 | $parser->param = $param; |
@@ -52,7 +52,8 @@ discard block |
||
52 | 52 | } |
53 | 53 | $ids = array_merge($ids, $objectParser->parse([$relation['col'] => $this->model->pk()])); |
54 | 54 | } |
55 | - } else { |
|
55 | + } |
|
56 | + else { |
|
56 | 57 | $objectParser = new \Migrations\Parser\Object(); |
57 | 58 | $objectParser->object = $object; |
58 | 59 | $objectParser->parentObject = $this->object; |
@@ -85,7 +86,8 @@ discard block |
||
85 | 86 | $delObject->delete(); |
86 | 87 | } |
87 | 88 | } |
88 | - } else { |
|
89 | + } |
|
90 | + else { |
|
89 | 91 | $objectParser = new \Migrations\Parser\Object(); |
90 | 92 | $objectParser->object = $object; |
91 | 93 | $objectParser->parentObject = $this->object; |
@@ -100,7 +102,8 @@ discard block |
||
100 | 102 | $ids[] = $model->id; |
101 | 103 | } |
102 | 104 | } |
103 | - } else { |
|
105 | + } |
|
106 | + else { |
|
104 | 107 | $model = $objectParser->setModel($this->data); |
105 | 108 | if ($model && $model->id) { |
106 | 109 | $ids[] = $model->id; |
@@ -38,7 +38,8 @@ discard block |
||
38 | 38 | $itemModel = get_class($item); |
39 | 39 | $relation = $itemModel::getRelation($relationName); |
40 | 40 | $sourceModel = $relation['model']; |
41 | - } else { |
|
41 | + } |
|
42 | + else { |
|
42 | 43 | $relation = $modelName::getRelation($type['relation']); |
43 | 44 | $sourceModel = $relation['model']; |
44 | 45 | } |
@@ -49,10 +50,12 @@ discard block |
||
49 | 50 | } |
50 | 51 | break; |
51 | 52 | } |
52 | - } else { |
|
53 | + } |
|
54 | + else { |
|
53 | 55 | $type = $col['type']; |
54 | 56 | } |
55 | - } else { |
|
57 | + } |
|
58 | + else { |
|
56 | 59 | $type = 'text'; |
57 | 60 | } |
58 | 61 | |
@@ -63,7 +66,8 @@ discard block |
||
63 | 66 | $valueObject->param_id = $this->param->id; |
64 | 67 | $valueObject->original = $value; |
65 | 68 | $valueObject->save(); |
66 | - } else { |
|
69 | + } |
|
70 | + else { |
|
67 | 71 | $valueObject = $values[$value]; |
68 | 72 | } |
69 | 73 | $value = $valueObject->replace; |
@@ -22,7 +22,8 @@ discard block |
||
22 | 22 | foreach ($this->data as &$data) { |
23 | 23 | $this->parseData($data, $params); |
24 | 24 | } |
25 | - } else { |
|
25 | + } |
|
26 | + else { |
|
26 | 27 | $this->parseData($this->data, $params); |
27 | 28 | } |
28 | 29 | } |
@@ -44,7 +45,8 @@ discard block |
||
44 | 45 | $valueObject->param_id = $param->id; |
45 | 46 | $valueObject->original = (string) $objectParam; |
46 | 47 | $valueObject->save(); |
47 | - } else { |
|
48 | + } |
|
49 | + else { |
|
48 | 50 | $objectParamValue['col'] = $col->replace; |
49 | 51 | } |
50 | 52 | break; |
@@ -27,7 +27,8 @@ discard block |
||
27 | 27 | //walk know pathes |
28 | 28 | foreach ($this->map->paths(['where' => ['path', $this->curPath]]) as $path) { |
29 | 29 | if (isset($this->data[$path->item])) { |
30 | - if ($path->type == 'container') { //create walker for container |
|
30 | + if ($path->type == 'container') { |
|
31 | +//create walker for container |
|
31 | 32 | $walker = new Walker(); |
32 | 33 | $walker->migration = $this->migration; |
33 | 34 | $walker->map = $this->map; |
@@ -37,7 +38,9 @@ discard block |
||
37 | 38 | $walker->mapPathParent = $this->mapPath; |
38 | 39 | $walker->migtarionLog = $this->migtarionLog; |
39 | 40 | $walker->walk(); |
40 | - } elseif ($path->type == 'object') { //start parse path data |
|
41 | + } |
|
42 | + elseif ($path->type == 'object') { |
|
43 | +//start parse path data |
|
41 | 44 | $this->startObjectParse($path->object_id, $this->data[$path->item]); |
42 | 45 | } |
43 | 46 | } |
@@ -54,9 +57,12 @@ discard block |
||
54 | 57 | ['code', $key], |
55 | 58 | ['migration_id', $this->migration->id] |
56 | 59 | ]); |
57 | - if ($object) { //parse as object |
|
60 | + if ($object) { |
|
61 | +//parse as object |
|
58 | 62 | $this->startObjectParse($object, $data); |
59 | - } else { //create new map path for configure unknown path |
|
63 | + } |
|
64 | + else { |
|
65 | +//create new map path for configure unknown path |
|
60 | 66 | $this->mapPath = new Migration\Map\Path(); |
61 | 67 | $this->mapPath->parent_id = $this->mapPathParent ? $this->mapPathParent->id : 0; |
62 | 68 | $this->mapPath->path = $this->curPath; |
@@ -79,7 +85,8 @@ discard block |
||
79 | 85 | $where = json_decode($objectParser->object->clear, true); |
80 | 86 | if (!$where) { |
81 | 87 | $where = []; |
82 | - } else { |
|
88 | + } |
|
89 | + else { |
|
83 | 90 | $where = [[$where]]; |
84 | 91 | } |
85 | 92 | if ($ids) { |