Fix displaying woocommerce static segment in dynamic segments
[MAILPOET-3361]
This commit is contained in:
@@ -4,7 +4,12 @@ namespace MailPoet\Segments\DynamicSegments;
|
|||||||
|
|
||||||
use MailPoet\Entities\SegmentEntity;
|
use MailPoet\Entities\SegmentEntity;
|
||||||
use MailPoet\Segments\SegmentListingRepository;
|
use MailPoet\Segments\SegmentListingRepository;
|
||||||
|
use MailPoetVendor\Doctrine\ORM\QueryBuilder;
|
||||||
|
|
||||||
class DynamicSegmentsListingRepository extends SegmentListingRepository {
|
class DynamicSegmentsListingRepository extends SegmentListingRepository {
|
||||||
protected $types = [SegmentEntity::TYPE_DYNAMIC];
|
protected function applyParameters(QueryBuilder $queryBuilder, array $parameters) {
|
||||||
|
$queryBuilder
|
||||||
|
->andWhere('s.type = :type')
|
||||||
|
->setParameter('type', SegmentEntity::TYPE_DYNAMIC);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -15,8 +15,6 @@ class SegmentListingRepository extends ListingRepository {
|
|||||||
/** @var WooCommerce */
|
/** @var WooCommerce */
|
||||||
private $wooCommerce;
|
private $wooCommerce;
|
||||||
|
|
||||||
protected $types = [SegmentEntity::TYPE_DEFAULT, SegmentEntity::TYPE_WP_USERS];
|
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
EntityManager $entityManager,
|
EntityManager $entityManager,
|
||||||
WooCommerce $wooCommerce
|
WooCommerce $wooCommerce
|
||||||
@@ -52,7 +50,7 @@ class SegmentListingRepository extends ListingRepository {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected function applyParameters(QueryBuilder $queryBuilder, array $parameters) {
|
protected function applyParameters(QueryBuilder $queryBuilder, array $parameters) {
|
||||||
$types = $this->types;
|
$types = [SegmentEntity::TYPE_DEFAULT, SegmentEntity::TYPE_WP_USERS];
|
||||||
if ($this->wooCommerce->shouldShowWooCommerceSegment()) {
|
if ($this->wooCommerce->shouldShowWooCommerceSegment()) {
|
||||||
$types[] = SegmentEntity::TYPE_WC_USERS;
|
$types[] = SegmentEntity::TYPE_WC_USERS;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user