}
}
- // Always select the ID.
- $this->selectFields[self::MAIN_TABLE_ALIAS . ".id"] = "id";
+ // Always select the ID if the table has one.
+ if (array_key_exists('id', $this->apiFieldSpec)) {
+ $this->selectFields[self::MAIN_TABLE_ALIAS . ".id"] = "id";
+ }
// core return fields
foreach ($return as $fieldName) {