Commit 492d8ac1c1ea0e337bff99cd354bfab3f5d5bdaf
1 parent
2a7a75b8
finishing with converter and dynamic form
Showing
4 changed files
with
11 additions
and
4 deletions
Show diff stats
backend/components/parsers/CustomCsvParser.php
... | ... | @@ -17,14 +17,12 @@ class CustomCsvParser extends \yii\multiparser\CsvParser { |
17 | 17 | public function setupConverter() |
18 | 18 | { |
19 | 19 | |
20 | - | |
21 | 20 | if ($this->hasHeaderRow) { |
22 | 21 | // если у файла есть заголовок, то в результате имеем ассоциативный массив |
23 | 22 | $this->converter_conf['hasKey'] = 1; |
24 | 23 | } |
25 | 24 | |
26 | 25 | $this->converter = \Yii::createObject($this->converter_conf); |
27 | - \common\components\CustomVarDamp::dumpAndDie($this); | |
28 | 26 | |
29 | 27 | } |
30 | 28 | ... | ... |
backend/components/parsers/config.php
backend/controllers/ParserController.php
... | ... | @@ -120,7 +120,9 @@ public function actionWrite() |
120 | 120 | //CustomVarDamp::dumpAndDie($model); |
121 | 121 | if ($model->validate()) { |
122 | 122 | $arr = $model->toArray(); |
123 | - CustomVarDamp::dumpAndDie($arr); | |
123 | + $data = json_decode( Yii::$app->getCache()->get( 'parser_data' ),true ); | |
124 | + | |
125 | + CustomVarDamp::dumpAndDie(DynamicFormHelper::CreateAssocArray($data, $arr)); | |
124 | 126 | } |
125 | 127 | |
126 | 128 | ... | ... |
common/components/CustomVarDamp.php
... | ... | @@ -17,10 +17,16 @@ class CustomVarDamp extends BaseVarDumper { |
17 | 17 | echo "</pre>"; |
18 | 18 | die; |
19 | 19 | } |
20 | - public static function dump($var, $depth = 10, $highlight = false) | |
20 | + public static function dump($var, $step = '', $depth = 10, $highlight = false) | |
21 | 21 | { |
22 | 22 | echo "<pre>"; |
23 | + if ($step) { | |
24 | + echo "-------------- {$step} -------------"; | |
25 | + } | |
23 | 26 | echo static::dumpAsString($var, $depth, $highlight); |
27 | + if ($step) { | |
28 | + echo "-------------- {$step} -------------"; | |
29 | + } | |
24 | 30 | echo "</pre>"; |
25 | 31 | |
26 | 32 | } | ... | ... |