Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
4 / 4
100.00% covered (success)
100.00%
4 / 4
CRAP
100.00% covered (success)
100.00%
1 / 1
SearchByInternalColumnFilter
100.00% covered (success)
100.00%
4 / 4
100.00% covered (success)
100.00%
4 / 4
4
100.00% covered (success)
100.00%
1 / 1
 __construct
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getFilterName
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getWhereCondition
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getOrderByCode
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2namespace Apie\DoctrineEntityDatalayer\Query;
3
4use Apie\Core\Datalayers\Search\QuerySearch;
5use Apie\DoctrineEntityDatalayer\Enums\SortingOrder;
6use Doctrine\DBAL\Connection;
7
8final class SearchByInternalColumnFilter implements FieldSearchFilterInterface, OrderByFilterInterface
9{
10    public function __construct(
11        private readonly string $filterName,
12        private readonly string $columnName,
13    ) {
14    }
15    public function getFilterName(): string
16    {
17        return $this->filterName;
18    }
19
20    public function getWhereCondition(QuerySearch $querySearch, Connection $connection): string
21    {
22        return 'entity.`' . $this->columnName . '` IS NOT NULL AND entity.`' . $this->columnName . '` <= CURRENT_TIMESTAMP()';
23    }
24
25    public function getOrderByCode(SortingOrder $sortingOrder): string
26    {
27        return 'entity.`' . $this->columnName . '` ' . $sortingOrder->value;
28    }
29}