Change return value from getItem in TransientCache
[MAILPOET-3778]
This commit is contained in:
@@ -18,7 +18,7 @@ class TransientCache {
|
||||
|
||||
public function getItem(string $key, int $id): ?array {
|
||||
$items = $this->getItems($key);
|
||||
return $items[$id]['item'] ?? null;
|
||||
return $items[$id] ?? null;
|
||||
}
|
||||
|
||||
public function getOldestCreatedAt(string $key): ?\DateTime {
|
||||
|
@@ -30,7 +30,7 @@ class SubscribersCountsController {
|
||||
}
|
||||
|
||||
public function getSubscribersWithoutSegmentStatisticsCount(): array {
|
||||
$result = $this->transientCache->getItem(TransientCache::SUBSCRIBERS_STATISTICS_COUNT_KEY, 0);
|
||||
$result = $this->transientCache->getItem(TransientCache::SUBSCRIBERS_STATISTICS_COUNT_KEY, 0)['item'] ?? null;
|
||||
if (!$result) {
|
||||
$result = $this->recalculateSubscribersWithoutSegmentStatisticsCache();
|
||||
}
|
||||
@@ -38,7 +38,7 @@ class SubscribersCountsController {
|
||||
}
|
||||
|
||||
public function getSegmentStatisticsCount(SegmentEntity $segment): array {
|
||||
$result = $this->transientCache->getItem(TransientCache::SUBSCRIBERS_STATISTICS_COUNT_KEY, (int)$segment->getId());
|
||||
$result = $this->transientCache->getItem(TransientCache::SUBSCRIBERS_STATISTICS_COUNT_KEY, (int)$segment->getId())['item'] ?? null;
|
||||
if (!$result) {
|
||||
$result = $this->recalculateSegmentStatisticsCache($segment);
|
||||
}
|
||||
@@ -46,7 +46,7 @@ class SubscribersCountsController {
|
||||
}
|
||||
|
||||
public function getSegmentGlobalStatusStatisticsCount(SegmentEntity $segment): array {
|
||||
$result = $this->transientCache->getItem(TransientCache::SUBSCRIBERS_GLOBAL_STATUS_STATISTICS_COUNT_KEY, (int)$segment->getId());
|
||||
$result = $this->transientCache->getItem(TransientCache::SUBSCRIBERS_GLOBAL_STATUS_STATISTICS_COUNT_KEY, (int)$segment->getId())['item'] ?? null;
|
||||
if (!$result) {
|
||||
$result = $this->recalculateSegmentGlobalStatusStatisticsCache($segment);
|
||||
}
|
||||
@@ -54,7 +54,7 @@ class SubscribersCountsController {
|
||||
}
|
||||
|
||||
public function getSegmentStatisticsCountById(int $segmentId): array {
|
||||
$result = $this->transientCache->getItem(TransientCache::SUBSCRIBERS_STATISTICS_COUNT_KEY, $segmentId);
|
||||
$result = $this->transientCache->getItem(TransientCache::SUBSCRIBERS_STATISTICS_COUNT_KEY, $segmentId)['item'] ?? null;
|
||||
if (!$result) {
|
||||
$segment = $this->segmentsRepository->findOneById($segmentId);
|
||||
if (!$segment) {
|
||||
|
Reference in New Issue
Block a user