Exceptions
2 months ago
Filters
1 month ago
DynamicSegmentFilterRepository.php
4 years ago
DynamicSegmentsListingRepository.php
1 month ago
FilterDataMapper.php
1 month ago
FilterFactory.php
2 months ago
FilterHandler.php
2 months ago
SegmentSaveController.php
2 years ago
index.php
3 years ago
DynamicSegmentsListingRepository.php
24 lines
| 1 | <?php // phpcs:ignore SlevomatCodingStandard.TypeHints.DeclareStrictTypes.DeclareStrictTypesMissing |
| 2 | |
| 3 | namespace MailPoet\Segments\DynamicSegments; |
| 4 | |
| 5 | if (!defined('ABSPATH')) exit; |
| 6 | |
| 7 | |
| 8 | use MailPoet\Entities\SegmentEntity; |
| 9 | use MailPoet\Segments\SegmentListingRepository; |
| 10 | use MailPoetVendor\Doctrine\ORM\QueryBuilder; |
| 11 | |
| 12 | class DynamicSegmentsListingRepository extends SegmentListingRepository { |
| 13 | protected function applyFilters(QueryBuilder $queryBuilder, array $filters) { |
| 14 | $this->applyDateRangeFilter($queryBuilder, 's.createdAt', $filters, 'created_from', 'created_to'); |
| 15 | $this->applyDateRangeFilter($queryBuilder, 's.updatedAt', $filters, 'updated_from', 'updated_to'); |
| 16 | } |
| 17 | |
| 18 | protected function applyParameters(QueryBuilder $queryBuilder, array $parameters): void { |
| 19 | $queryBuilder |
| 20 | ->andWhere('s.type = :type') |
| 21 | ->setParameter('type', SegmentEntity::TYPE_DYNAMIC); |
| 22 | } |
| 23 | } |
| 24 |