diff options
author | Stefan Giehl <stefan@matomo.org> | 2020-04-23 10:43:30 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-23 10:43:30 +0300 |
commit | a8d917778e75346eab9509ac9707f7e6e2e6c58d (patch) | |
tree | 8259898ab33eb882e631f1f5475cd1482f70e402 /plugins/Ecommerce | |
parent | 0cdeb6da6e4679c56aa351c004cbd6afe7843c56 (diff) |
Refactores the way segments are configured in dimensions (#15836)
* Improve naming of methods for segments to rescrict access for anonymous user
* Introduce new classes SegmentsList nad DimensionSegmentFactory
* removes SegmentEditor\SegmentList and adds some tests
* submodule updates
Diffstat (limited to 'plugins/Ecommerce')
-rw-r--r-- | plugins/Ecommerce/Columns/ProductCategory.php | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/plugins/Ecommerce/Columns/ProductCategory.php b/plugins/Ecommerce/Columns/ProductCategory.php index 6ec80b649e..bd4c0d07a6 100644 --- a/plugins/Ecommerce/Columns/ProductCategory.php +++ b/plugins/Ecommerce/Columns/ProductCategory.php @@ -9,8 +9,10 @@ namespace Piwik\Plugins\Ecommerce\Columns; use Piwik\Columns\Dimension; +use Piwik\Columns\DimensionSegmentFactory; use Piwik\Piwik; use Piwik\Plugin\Segment; +use Piwik\Segment\SegmentsList; class ProductCategory extends Dimension { @@ -20,7 +22,7 @@ class ProductCategory extends Dimension protected $category = 'Goals_Ecommerce'; protected $nameSingular = 'Goals_ProductCategory'; - protected function configureSegments() + public function configureSegments(SegmentsList $segmentsList, DimensionSegmentFactory $dimensionSegmentFactory) { $individualProductCategorySegments = $this->getProductCategorySegments(self::PRODUCT_CATEGORY_COUNT); @@ -39,7 +41,7 @@ class ProductCategory extends Dimension $segment->setSqlFilter('\\Piwik\\Tracker\\TableLogAction::getIdActionFromSegment'); $segment->setSqlSegment('log_conversion_item.' . $productCategoryColumnName); $segment->setIsInternal(true); - $this->addSegment($segment); + $segmentsList->addSegment($dimensionSegmentFactory->createSegment($segment)); } // add a union of these individual columns as productCategory @@ -49,7 +51,7 @@ class ProductCategory extends Dimension $segment->setSegment('productCategory'); $segment->setName($this->getName()); $segment->setUnionOfSegments($individualProductCategorySegments); - $this->addSegment($segment); + $segmentsList->addSegment($dimensionSegmentFactory->createSegment($segment)); } private function getProductCategorySegments($categoryCount) |