Skip to content

Commit

Permalink
fix: pairsType bug
Browse files Browse the repository at this point in the history
  • Loading branch information
forecho committed Apr 19, 2020
1 parent 5ffee5f commit 67b4a09
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/models/ActionStore.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,11 +119,15 @@ public static function createUpdateAction($model, $pairsType = [], $counterType
$pairsType1 = ArrayHelper::getValue($pairsType, 1);
switch ($model->type) {
case $pairsType0:
$model::find()->where(array_merge(['type' => $pairsType1], $conditions))->one()->delete();
if ($model::find()->where(array_merge(['type' => $pairsType1], $conditions))->one()) {
$model->delete();
}
$data = array_merge(['type' => $pairsType0], $conditions);
break;
case $pairsType1:
$model::find()->where(array_merge(['type' => $pairsType0], $conditions))->one()->delete();
if ($model::find()->where(array_merge(['type' => $pairsType0], $conditions))->one()) {
$model->delete();
}
$data = array_merge(['type' => $pairsType1], $conditions);
break;

Expand Down

0 comments on commit 67b4a09

Please sign in to comment.