|
|
@@ -238,8 +238,10 @@ class CounterCacheBehavior extends Behavior
|
|
|
} else {
|
|
|
$count = $this->_getCount($config, $countConditions);
|
|
|
}
|
|
|
-
|
|
|
- $assoc->getTarget()->updateAll([$field => $count], $updateConditions);
|
|
|
+ if (!is_null($count)) {
|
|
|
+ $assoc->getTarget()->updateAll([$field => $count],
|
|
|
+ $updateConditions);
|
|
|
+ }
|
|
|
|
|
|
if (isset($updateOriginalConditions)) {
|
|
|
if (is_callable($config)) {
|
|
|
@@ -250,7 +252,10 @@ class CounterCacheBehavior extends Behavior
|
|
|
} else {
|
|
|
$count = $this->_getCount($config, $countOriginalConditions);
|
|
|
}
|
|
|
- $assoc->getTarget()->updateAll([$field => $count], $updateOriginalConditions);
|
|
|
+ if (!is_null($count)) {
|
|
|
+ $assoc->getTarget()->updateAll([$field => $count],
|
|
|
+ $updateOriginalConditions);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|