Comparing
#1 with
#3
Content
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.[...]

** Important: Apply cascatde to foreign key
, constraints for update and
Ddelete. **
Th
ise 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 S
qlQL the ralation has.[...]
}
// deletando de vinculo
public function actionDeleteTestAll()
{
$game = Games::findOne(1);
foreach($game->tests as $test)
{
$test->delete();
}
}
public function actionDeleteTheRelation($id)
{[...]