Skip to content

Commit

Permalink
Remove ignore and check if implements ConditionallyDeletes interface
Browse files Browse the repository at this point in the history
  • Loading branch information
m1k3lm committed Oct 9, 2024
1 parent d504356 commit 61b5ec2
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@
namespace SeQura\Core\BusinessLogic\DataAccess\TransactionLog\Repositories;

use DateTime;
use RuntimeException;
use SeQura\Core\BusinessLogic\DataAccess\TransactionLog\Entities\TransactionLog;
use SeQura\Core\BusinessLogic\Domain\Multistore\StoreContext;
use SeQura\Core\BusinessLogic\TransactionLog\RepositoryContracts\TransactionLogRepositoryInterface;
use SeQura\Core\Infrastructure\ORM\Exceptions\QueryFilterInvalidParamException;
use SeQura\Core\Infrastructure\ORM\Interfaces\ConditionallyDeletes;
use SeQura\Core\Infrastructure\ORM\Interfaces\RepositoryInterface;
use SeQura\Core\Infrastructure\ORM\QueryFilter\Operators;
use SeQura\Core\Infrastructure\ORM\QueryFilter\QueryFilter;
Expand Down Expand Up @@ -185,7 +187,9 @@ public function deleteLogs(DateTime $beforeDate, int $limit): void
->where('storeId', Operators::EQUALS, $this->storeContext->getStoreId());
$queryFilter->setLimit($limit);

// @phpstan-ignore-next-line
if (! $this->repository instanceof ConditionallyDeletes) {
throw new RuntimeException('Repository does not support deleteWhere method');
}
$this->repository->deleteWhere($queryFilter);
}

Expand All @@ -199,7 +203,9 @@ public function deleteTransactionLogById(int $id): void
$queryFilter = new QueryFilter();
$queryFilter->where('id', Operators::EQUALS, $id);

// @phpstan-ignore-next-line
if (! $this->repository instanceof ConditionallyDeletes) {
throw new RuntimeException('Repository does not support deleteWhere method');
}
$this->repository->deleteWhere($queryFilter);
}

Expand Down

0 comments on commit 61b5ec2

Please sign in to comment.