File tree Expand file tree Collapse file tree 1 file changed +10
-8
lines changed Expand file tree Collapse file tree 1 file changed +10
-8
lines changed Original file line number Diff line number Diff line change @@ -192,14 +192,16 @@ public function saveAll()
192192 $ error = true ;
193193 }
194194 }else {
195- foreach ($ rel ['link ' ] as $ k => $ v ) {
196- $ condition [] = $ k . " = " . $ this ->$ v ;
197- }
198- try {
199- $ relModel ->deleteAll (implode (" AND " , $ condition ));
200- } catch (\yii \db \IntegrityException $ exc ) {
201- $ this ->addError ($ rel ['name ' ], "Data can't be deleted because it's still used by another data. " );
202- $ error = true ;
195+ if ($ rel ['ismultiple ' ]){
196+ foreach ($ rel ['link ' ] as $ k => $ v ) {
197+ $ condition [] = $ k . " = " . $ this ->$ v ;
198+ }
199+ try {
200+ $ relModel ->deleteAll (implode (" AND " , $ condition ));
201+ } catch (\yii \db \IntegrityException $ exc ) {
202+ $ this ->addError ($ rel ['name ' ], "Data can't be deleted because it's still used by another data. " );
203+ $ error = true ;
204+ }
203205 }
204206 }
205207 }
You can’t perform that action at this time.
0 commit comments