Difference between #1 and #3 of
Working with relational removals by yii2

Changes

Title unchanged

Working with relational removals by yii2

Category unchanged

Tutorials

Yii version unchanged

Tags unchanged

model, relations, remove, delete

Content changed

This tutorial shows you how to safely and safely remove relationshipremove records between relationships and multiple lines.

First we create three tables using a Many to Many relationship.
[...]
![Imagem da relacao](http://github.com/androidealp/Tutoriais/blob/master/yii-trabalhando-com-remocoes-relacionais/relacao-exemplo.jpg?raw=true "Image relation")

** Important: Apply casca
tde to foreign key, constraints for update and Ddelete. ** Thise cascade feature will allow you to remove the foreign keys along with the line you want to delete. This is very useful not to pollute your code. and helps keep your code to a minimum.  Script SqlQL the ralation has.
[...]
}
     // deletando de vinculo
 
     public function actionDeleteTestAll()
 
     {
 
       $game = Games::findOne(1);
 
       foreach($game->tests as $test)
 
       {
 
          $test->delete();
 
       }
 
     }
 


public function actionDeleteTheRelation($id)
{
[...]
0 0
2 followers
Viewed: 36 690 times
Version: 2.0
Category: Tutorials
Written by: AndroideLP
Last updated by: Jairus Martin
Created on: Dec 23, 2016
Last updated: 7 years ago
Update Article

Revisions

View all history