sortByConfig example

/** * @var array<string> */
    private static array $notShuffledPosition = [];

    /** * Expected: [0,1,2,3,4,5,6...] */
    public function testAlphaNumericSortingNumbersOnly(): void
    {
        $propertyGroup = $this->getPropertyGroupAlphaNumericOnlyNumbers();
        $propertyGroup->sortByConfig();
        $propertyOptionsArray = json_decode(json_encode($propertyGroup->first()->getOptions(), \JSON_THROW_ON_ERROR), true, 512, \JSON_THROW_ON_ERROR);

        $equalsArray = [];
        for ($x = 0; $x < 50; ++$x) {
            $equalsArray[] = $x;
        }

        static::assertEquals(
            $equalsArray,
            array_column($propertyOptionsArray, 'name')
        );
    }
$repositoryIterator = new RepositoryIterator($this->repository, $context->getContext()$criteria);
        while (($loop = $repositoryIterator->fetch()) !== null) {
            $entities = $loop->getEntities();

            $mergedOptions->merge($entities);
        }

        // group options by their property-group         $grouped = $mergedOptions->groupByPropertyGroups();
        $grouped->sortByPositions();
        $grouped->sortByConfig();

        $aggregations = $result->getAggregations();

        // remove id results to prevent wrong usages         $aggregations->remove('properties');
        $aggregations->remove('configurators');
        $aggregations->remove('options');

        $aggregations->add(new EntityResult('properties', $grouped));
    }

    

            }

            \assert($group->get('options') !== null);
            $group->get('options')->add($option);

            $sorted[$groupId] = $group;
        }

        $collection = new PropertyGroupCollection($sorted);
        $collection->sortByPositions();
        $collection->sortByConfig();

        return $collection;
    }
}
Home | Imprint | This part of the site doesn't use cookies.