Open neo2005th opened 7 years ago
Now i can delete the main model with it's related with $this->findModel($id)->deleteWithRelated() rather than $this->findModel($id)->delete() in actionDelete, but still can't delete all subitems in update...
Solved this way, but surely it's not the best...
if(!isset(Yii::$app->request->post()['ProductsCharacteristicsRelations'])) ProductsCharacteristicsRelations::deleteAll(['id_product' => $id]);
It works perfect in action create but when i update the form and have a single element and i delete that element, it's not deleting the element from the database, same if i delete all items from the form just doesn't save the changes, i'm using a foreign key and because of that can't delete a product because i can't delete the child elemente, and must delete all elements when i empty the form...