collection = $collection->create()->addFieldToSelect('*')->setOrder('name', Collection::SORT_ORDER_ASC); } /** * Get options in "key-value" format * * @return array */ public function toArray() { $array = []; foreach ($this->toOptionArray() as $item) { $array[$item['value']] = $item['label']; } return $array; } /** * Options getter * * @return array */ public function toOptionArray() { $options = []; foreach ($this->collection as $location) { $options[] = [ 'value' => $location->getLocationId(), 'label' => $location->getName(), ]; } return $options; } }