File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 99
1010class NestedArrayAdapter extends ArrayAdapter
1111{
12+ protected $ multipleValueSeparator ;
13+
1214 /**
1315 * ArrayAdapter constructor.
1416 * @param array $data
17+ * @param string $multipleValueSeparator
1518 */
16- public function __construct ($ data )
19+ public function __construct ($ data, $ multipleValueSeparator = ' , ' )
1720 {
21+ $ this ->multipleValueSeparator = $ multipleValueSeparator ;
22+
1823 parent ::__construct ($ data );
1924 foreach ($ this ->_array as &$ row ) {
2025 foreach ($ row as $ colName => &$ value )
@@ -30,11 +35,11 @@ public function __construct($data)
3035 * Transform nested array to string
3136 *
3237 * @param array $line
33- * @return array
38+ * @return void
3439 */
3540 protected function convertToArray (&$ line )
3641 {
37- $ implodeStr = ' , ' ;
42+ $ implodeStr = $ this -> multipleValueSeparator ;
3843 $ arr = array_map (
3944 function ($ value , $ key ) use (&$ implodeStr ) {
4045 if (is_array ($ value ) && is_numeric ($ key )) {
Original file line number Diff line number Diff line change @@ -21,7 +21,7 @@ public function __construct(
2121
2222 /**
2323 * @param array $data
24- * @return \FireGento\FastSimpleImport\Model\Adapters\ArrayAdapter
24+ * @return \FireGento\FastSimpleImport\Model\Adapters\NestedArrayAdapter
2525 */
2626 public function create (array $ data = [])
2727 {
Original file line number Diff line number Diff line change @@ -118,7 +118,12 @@ public function processImport($dataArray)
118118 protected function _validateData ($ dataArray )
119119 {
120120 $ importModel = $ this ->createImportModel ();
121- $ source = $ this ->importAdapterFactory ->create (array ('data ' => $ dataArray ));
121+ $ source = $ this ->importAdapterFactory ->create (
122+ array (
123+ 'data ' => $ dataArray ,
124+ 'multipleValueSeparator ' => $ this ->getMultipleValueSeparator ()
125+ )
126+ );
122127 $ this ->validationResult = $ importModel ->validateSource ($ source );
123128 $ this ->addToLogTrace ($ importModel );
124129 return $ this ->validationResult ;
You can’t perform that action at this time.
0 commit comments