-
Notifications
You must be signed in to change notification settings - Fork 45
Open
Description
Type 🐛
class Company () {
...
public function getBranches()
{
return $this->hasMany(\common\models\Branch::className(), ['company_id' => 'id'])
->andWhere(['type' =< 10 ]);
}
}
on update company record, those record with type 11 and above got deleted...
Suggestion :
add $ignoreClause parameter for saveAll() as additional
public function saveAll($skippedRelations = [],$ignoreClause = [])
{
....
$query = ['and', $notDeletedFK, ['not in', $relPKAttr[0], $notDeletedPK]];
array_push($query, $ignoreClause); ....
...
if (!empty($notDeletedPK)) {
try {
if ($isSoftDelete) {
$relModel->updateAll($this->_rt_softdelete, $query);
} else {
$relModel->deleteAll($query);
}
} catch (IntegrityException $exc) {
$this->addError($name, "Data can't be deleted because it's still used by another data.");
$error = true;
}
}
....
}
or adding list of effectiveIds only
Metadata
Metadata
Assignees
Labels
No labels