collection = $collection; } public function toOptionArray() { $collection = $this->collection->addFieldToSelect('firstname'); foreach ($collection as $customer) { $customerId = $customer->getEntityId(); if (!isset($customerById[$customerId])) { $customerById[$customerId] = [ 'value' => $customerId ]; } $customerById[$customerId]['label'] = $customer->getFirstname(); } $this->customerTree = $customerById; return $this->customerTree; } }