Skip to content

Commit

Permalink
# Fixed not updating relations without softdelete when main model had…
Browse files Browse the repository at this point in the history
… soft delete
  • Loading branch information
bpanatta committed May 15, 2018
1 parent 0748d41 commit c9d82a9
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions RelationTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ public function saveAll($skippedRelations = [])
array_push($query, $notIn);
}
try {
if ($isSoftDelete) {
if ($isSoftDelete && isset($relModel->_rt_softdelete)) {
$relModel->updateAll($this->_rt_softdelete, $query);
} else {
$relModel->deleteAll($query);
Expand All @@ -224,7 +224,7 @@ public function saveAll($skippedRelations = [])
$query = ['and', $notDeletedFK, ['not in', $relPKAttr[0], $notDeletedPK]];
if (!empty($notDeletedPK)) {
try {
if ($isSoftDelete) {
if ($isSoftDelete && isset($relModel->_rt_softdelete)) {
$relModel->updateAll($this->_rt_softdelete, $query);
} else {
$relModel->deleteAll($query);
Expand Down Expand Up @@ -288,7 +288,7 @@ public function saveAll($skippedRelations = [])
$condition[$k] = $this->$v;
}
try {
if ($isSoftDelete) {
if ($isSoftDelete && isset($relModel->_rt_softdelete)) {
$relModel->updateAll($this->_rt_softdelete, ['and', $condition]);
} else {
$relModel->deleteAll(['and', $condition]);
Expand All @@ -303,7 +303,7 @@ public function saveAll($skippedRelations = [])
$condition[$k] = $this->$v;
}
try {
if ($isSoftDelete) {
if ($isSoftDelete && isset($relModel->_rt_softdelete)) {
$relModel->updateAll($this->_rt_softdelete, ['and', $condition]);
} else {
$relModel->deleteAll(['and', $condition]);
Expand Down

0 comments on commit c9d82a9

Please sign in to comment.