Some more last-minute fixes.

This commit is contained in:
James Cole
2018-06-02 19:23:46 +02:00
parent a6b09acd5e
commit 2f824ba1a8
3 changed files with 34 additions and 9 deletions

View File

@@ -61,6 +61,7 @@ use Steam;
*/
class JournalCollector implements JournalCollectorInterface
{
/** @var array */
private $accountIds = [];
/** @var int */
@@ -107,7 +108,8 @@ class JournalCollector implements JournalCollectorInterface
];
/** @var array */
private $filters = [InternalTransferFilter::class];
/** @var bool */
private $ignoreCache = false;
/** @var bool */
private $joinedBudget = false;
/** @var bool */
@@ -258,12 +260,15 @@ class JournalCollector implements JournalCollectorInterface
foreach ($this->filters as $filter) {
$cache->addProperty((string)$filter);
}
if ($cache->has()) {
if (false === $this->ignoreCache && $cache->has()) {
Log::debug(sprintf('Return cache of query with ID "%s".', $key));
return $cache->get(); // @codeCoverageIgnore
}
}
if (true === $this->ignoreCache) {
Log::debug('Ignore cache in journal collector.');
}
/** @var Collection $set */
$set = $this->query->get(array_values($this->fields));
@@ -316,6 +321,16 @@ class JournalCollector implements JournalCollectorInterface
return $journals;
}
/**
* @return JournalCollectorInterface
*/
public function ignoreCache(): JournalCollectorInterface
{
$this->ignoreCache = true;
return $this;
}
/**
* @param string $filter
*
@@ -786,7 +801,7 @@ class JournalCollector implements JournalCollectorInterface
/**
*
*/
private function joinBudgetTables()
private function joinBudgetTables(): void
{
if (!$this->joinedBudget) {
// join some extra tables:
@@ -811,7 +826,7 @@ class JournalCollector implements JournalCollectorInterface
/**
*
*/
private function joinCategoryTables()
private function joinCategoryTables(): void
{
if (!$this->joinedCategory) {
// join some extra tables:
@@ -841,7 +856,7 @@ class JournalCollector implements JournalCollectorInterface
/**
*
*/
private function joinOpposingTables()
private function joinOpposingTables(): void
{
if (!$this->joinedOpposing) {
Log::debug('joinedOpposing is false');
@@ -873,7 +888,7 @@ class JournalCollector implements JournalCollectorInterface
/**
*
*/
private function joinTagTables()
private function joinTagTables(): void
{
if (!$this->joinedTag) {
// join some extra tables:

View File

@@ -78,6 +78,11 @@ interface JournalCollectorInterface
*/
public function getPaginatedJournals(): LengthAwarePaginator;
/**
* @return JournalCollectorInterface
*/
public function ignoreCache(): JournalCollectorInterface;
/**
* @param string $filter
*