protected function _initializeCustomfields()
 {
     foreach (TBGCustomDatatype::getAll() as $key => $customdatatype) {
         $var_name = "_customfield" . $key;
         $this->{$var_name} = null;
     }
     if ($rows = TBGIssueCustomFieldsTable::getTable()->getAllValuesByIssueID($this->getID())) {
         foreach ($rows as $row) {
             $datatype = new TBGCustomDatatype($row->get(TBGIssueCustomFieldsTable::CUSTOMFIELDS_ID));
             $var_name = "_customfield" . $datatype->getKey();
             if ($datatype->hasCustomOptions()) {
                 $option = TBGCustomFieldOptionsTable::getTable()->selectById((int) $row->get(TBGIssueCustomFieldsTable::CUSTOMFIELDOPTION_ID));
                 if ($option instanceof TBGCustomDatatypeOption) {
                     $this->{$var_name} = $option;
                 }
             } else {
                 if ($datatype->hasPredefinedOptions()) {
                     $this->{$var_name} = $row->get(TBGIssueCustomFieldsTable::CUSTOMFIELDOPTION_ID);
                 } else {
                     $this->{$var_name} = $row->get(TBGIssueCustomFieldsTable::OPTION_VALUE);
                 }
             }
         }
     }
 }