/**
  * @return ArrayList
  */
 protected function getOptions()
 {
     $options = ArrayList::create();
     $source = $this->getSource();
     if (!$source) {
         $source = new ArrayList();
     }
     $dataClass = $source->dataClass();
     $values = $this->Value();
     if (!$values) {
         return $options;
     }
     if (is_array($values)) {
         $values = DataList::create($dataClass)->filter('ID', $values);
     }
     $ids = $values->column('ID');
     $titleField = $this->getTitleField();
     foreach ($source as $object) {
         $options->push(ArrayData::create(array('Title' => $object->{$titleField}, 'Value' => $object->ID, 'Selected' => in_array($object->ID, $ids))));
     }
     return $options;
 }
 /**
  * @return ArrayList
  */
 protected function getOptions()
 {
     $options = ArrayList::create();
     $source = $this->getSource();
     if (!$source) {
         $source = new ArrayList();
     }
     $dataClass = $source->dataClass();
     $values = $this->Value();
     // Mark selected tags while still returning a full list of possible options
     $ids = array();
     // empty fallback array for comparing
     $values = $this->Value();
     if ($values) {
         // @TODO conversion from array to DataList to array...(?)
         if (is_array($values)) {
             $values = DataList::create($dataClass)->filter('ID', $values);
         }
         $ids = $values->column('ID');
     }
     $titleField = $this->getTitleField();
     foreach ($source as $object) {
         $options->push(ArrayData::create(array('Title' => $object->{$titleField}, 'Value' => $object->ID, 'Selected' => in_array($object->ID, $ids))));
     }
     return $options;
 }