File tree 1 file changed +9
-4
lines changed
1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -62,15 +62,18 @@ public function onRow(Row $row)
62
62
$ newData = array ();
63
63
$ updatedData = array ();
64
64
65
+ $ hasNotNULL = false ;
66
+ //check not NULL columns
65
67
foreach ($ this ->notNullColumnNames as $ notNullColumn ) {
68
+ //if there is not the column in the row
66
69
if (!isset ($ row [$ notNullColumn ])) {
67
- unset( $ row ) ;
70
+ $ hasNotNULL = true ;
68
71
}
69
72
}
70
73
71
74
if (!empty ($ row [$ this ->key ])) {
72
75
$ exists = $ this ->model ->where ($ this ->key , '= ' , $ row [$ this ->key ])->count ();
73
- if (!$ exists ) {
76
+ if (!$ exists && ! $ hasNotNULL ) {
74
77
$ values = array ();
75
78
foreach ($ this ->columns as $ col ) {
76
79
if ($ col != $ this ->key && array_key_exists ($ col , $ row )) {
@@ -96,9 +99,11 @@ public function onRow(Row $row)
96
99
// update available data
97
100
if (!empty ($ updatedData )) {
98
101
foreach ($ updatedData as $ data ) {
99
- $ keyValue = $ data [$ this ->key ];
102
+ $ keyValue = ( int ) $ data [$ this ->key ];
100
103
unset($ data [$ this ->key ]);
101
- $ this ->model ->where ($ this ->key , $ keyValue )->update ($ data );
104
+ try {
105
+ $ this ->model ->where ($ this ->key , $ keyValue )->update ($ data );
106
+ }catch (\Exception $ e ){}
102
107
}
103
108
}
104
109
}
You can’t perform that action at this time.
0 commit comments