TOR); } $this->validateAttributeData($data); } public function validateAttributeData(array $data): void { $type = $data['attribute_type']; if (!in_array($type, [self::TYPE_LOCAL, self::TYPE_TAXONOMY], true)) { throw new InvalidFilterException('Invalid attribute type', InvalidFilterException::INVALID_TYPE); } if ($type === self::TYPE_LOCAL) { $name = $data['attribute_local_name'] ?? null; if (!is_string($name) || strlen($name) === 0) { throw new InvalidFilterException('Missing attribute', InvalidFilterException::MISSING_VALUE); } $values = $data['attribute_local_values'] ?? []; if (!is_array($values) || count($values) === 0) { throw new InvalidFilterException('Missing attribute values', InvalidFilterException::MISSING_VALUE); } } if ($type === self::TYPE_TAXONOMY) { $attribute_taxonomy_slug = $data['attribute_taxonomy_slug'] ?? null; if (!is_string($attribute_taxonomy_slug) || strlen($attribute_taxonomy_slug) === 0) { throw new InvalidFilterException('Missing attribute', InvalidFilterException::MISSING_VALUE); } if (!isset($data['attribute_term_ids']) || !is_array($data['attribute_term_ids']) || count($data['attribute_term_ids']) === 0) { throw new InvalidFilterException('Missing attribute terms', InvalidFilterException::MISSING_VALUE); } } } private function applyForTaxonomyAttribute(QueryBuilder $queryBuilder, DynamicSegmentFilterData $filterData) { $operator = $filterData->getOperator(); if ($operator === DynamicSegmentFilterData::OPERATOR_ANY) { $this->applyForTaxonomyAnyOperator($queryBuilder, $filterData); } elseif ($operator === DynamicSegmentFilterData::OPERATOR_ALL) { $this->applyForTaxonomyAnyOperator($queryBuilder, $filterData); $countParam = $this->filterHelper->getUniqueParameterName('count'); $queryBuilder ->groupBy('inner_subscriber_id') ->having("COUNT(DISTINCT attribute.term_id) = :$countParam") ->setParameter($countParam, count($filterData->getArrayParam('attribute_term_ids'))); } elseif ($operator === DynamicSegmentFilterData::OPERATOR_NONE) { $subQuery = $this->filterHelper->getNewSubscribersQueryBuilder(); $this->applyForTaxonomyAnyOperator($subQuery, $filterData); $subscribersTable = $this->filterHelper->getSubscribersTable(); $queryBuilder->where("{$subscribersTable}.id NOT IN ({$this->filterHelper->getInterpolatedSQL($subQuery)})"); } } private function applyForLocalAttribute(QueryBuilder $queryBuilder, DynamicSegmentFilterData $filterData): void { $operator = $filterData->getOperator(); if ($operator === DynamicSegmentFilterData::OPERATOR_ANY) { $this->applyForLocalAnyAttribute($queryBuilder, $filterData); } elseif ($operator === DynamicSegmentFilterData::OPERATOR_ALL) { $this->applyForLocalAnyAttribute($queryBuilder, $filterData); $countParam = $this->filterHelper->getUniqueParameterName('count'); $queryBuilder ->groupBy('inner_subscriber_id') ->having("COUNT(DISTINCT postmeta.meta_value) = :$countParam") ->setParameter($countParam, count($filterData->getArrayParam('attribute_local_values'))); } elseif ($operator === DynamicSegmentFilterData::OPERATOR_NONE) { $subQuery = $this->filterHelper->getNewSubscribersQueryBuilder(); $this->applyForLocalAnyAttribute($subQuery, $filterData); $subscribersTable = $this->filterHelper->getSubscribersTable(); $queryBuilder->where("{$subscribersTable}.id NOT IN ({$this->filterHelper->getInterpolatedSQL($subQuery)})"); } } private function applyForLocalAnyAttribute(QueryBuilder $queryBuilder, DynamicSegmentFilterData $filterData): void { $attributeName = $filterData->getStringParam('attribute_local_name'); $attributeValues = $filterData->getArrayParam('attribute_local_values'); $valuesParam = $this->filterHelper->getUniqueParameterName('attribute_values'); $keyParam = $this->filterHelper->getUniqueParameterName('attribute_name'); $orderStatsAlias = $this->wooFilterHelper->applyOrderStatusFilter($queryBuilder); $productAlias = $this->applyProductJoin($queryBuilder, $orderStatsAlias); $queryBuilder->innerJoin( $productAlias, $this->filterHelper->getPrefixedTable('postmeta'), 'postmeta', "$productAlias.product_id = postmeta.post_id AND postmeta.meta_key = :$keyParam AND postmeta.meta_value IN (:$valuesParam)" ); $queryBuilder->setParameter($keyParam, sprintf("attribute_%s", $attributeName)); $queryBuilder->setParameter($valuesParam, $attributeValues, Connection::PARAM_STR_ARRAY); } }
Fatal error: Uncaught Error: Class "MailPoet\Segments\DynamicSegments\Filters\WooCommercePurchasedWithAttribute" not found in /htdocs/wp-content/plugins/mailpoet/generated/FreeCachedContainer.php:4628 Stack trace: #0 /htdocs/wp-content/plugins/mailpoet/generated/FreeCachedContainer.php(4348): MailPoetGenerated\FreeCachedContainer->getWooCommercePurchasedWithAttributeService() #1 /htdocs/wp-content/plugins/mailpoet/generated/FreeCachedContainer.php(4141): MailPoetGenerated\FreeCachedContainer->getFilterFactoryService() #2 /htdocs/wp-content/plugins/mailpoet/generated/FreeCachedContainer.php(4031): MailPoetGenerated\FreeCachedContainer->getSendingQueuesRepositoryService() #3 /htdocs/wp-content/plugins/mailpoet/generated/FreeCachedContainer.php(5088): MailPoetGenerated\FreeCachedContainer->getRenderer6Service() #4 /htdocs/wp-content/plugins/mailpoet/generated/FreeCachedContainer.php(5098): MailPoetGenerated\FreeCachedContainer->getConfirmationEmailCustomizerService() #5 /htdocs/wp-content/plugins/mailpoet/generated/FreeCachedContainer.php(5198): MailPoetGenerated\FreeCachedContainer->getConfirmationEmailMailerService() #6 /htdocs/wp-content/plugins/mailpoet/generated/FreeCachedContainer.php(5368): MailPoetGenerated\FreeCachedContainer->getSubscriberActionsService() #7 /htdocs/wp-content/plugins/mailpoet/generated/FreeCachedContainer.php(2612): MailPoetGenerated\FreeCachedContainer->getCommentService() #8 /htdocs/wp-content/plugins/mailpoet/generated/FreeCachedContainer.php(2640): MailPoetGenerated\FreeCachedContainer->getHooks2Service() #9 /htdocs/wp-content/plugins/mailpoet/vendor-prefixed/symfony/dependency-injection/Container.php(122): MailPoetGenerated\FreeCachedContainer->getInitializerService() #10 /htdocs/wp-content/plugins/mailpoet/vendor-prefixed/symfony/dependency-injection/Container.php(110): MailPoetVendor\Symfony\Component\DependencyInjection\Container->make('MailPoet\\Config...', 1) #11 /htdocs/wp-content/plugins/mailpoet/lib/DI/ContainerWrapper.php(39): MailPoetVendor\Symfony\Component\DependencyInjection\Container->get('MailPoet\\Config...') #12 /htdocs/wp-content/plugins/mailpoet/mailpoet_initializer.php(89): MailPoet\DI\ContainerWrapper->get('MailPoet\\Config...') #13 /htdocs/wp-content/plugins/mailpoet/mailpoet.php(194): require_once('/htdocs/wp-cont...') #14 /htdocs/wp-settings.php(526): include_once('/htdocs/wp-cont...') #15 /htdocs/wp-config.php(85): require_once('/htdocs/wp-sett...') #16 /htdocs/wp-load.php(50): require_once('/htdocs/wp-conf...') #17 /htdocs/wp-blog-header.php(13): require_once('/htdocs/wp-load...') #18 /htdocs/index.php(17): require('/htdocs/wp-blog...') #19 {main} thrown in /htdocs/wp-content/plugins/mailpoet/generated/FreeCachedContainer.php on line 4628