groupRepository = $groupRepository; $this->searchCriteriaBuilder = $searchCriteriaBuilder; $this->objectConverter = $objectConverter; } /** * @return array */ public function toOptionArray() { $customerGroups = $this->groupRepository->getList($this->searchCriteriaBuilder->create())->getItems(); return $this->objectConverter->toOptionArray($customerGroups, 'id', 'code'); } }