6 declare(strict_types=1);
10 use Magento\Customer\Model\ResourceModel\Group\CollectionFactory as CustomerGroupCollectionFactory;
25 private $collectionFactory;
30 private $customerGroupsDataIterator;
35 private $dimensionFactory;
39 $this->dimensionFactory = $dimensionFactory;
40 $this->collectionFactory = $collectionFactory;
45 foreach ($this->getCustomerGroups() as $customerGroup) {
46 yield $this->dimensionFactory->create(self::DIMENSION_NAME, (
string)$customerGroup);
53 private function getCustomerGroups(): array
55 if ($this->customerGroupsDataIterator ===
null) {
56 $customerGroups = $this->collectionFactory->create()->getAllIds();
57 $this->customerGroupsDataIterator = is_array($customerGroups) ? $customerGroups : [];
60 return $this->customerGroupsDataIterator;
__construct(CustomerGroupCollectionFactory $collectionFactory, DimensionFactory $dimensionFactory)