}
/**
- * Empty definition for virtual function.
+ * Returns the name of this table
+ *
+ * @return string
*/
public static function getTableName() {
- return NULL;
+ return self::getLocaleTableName(static::$_tableName ?? NULL);
+ }
+
+ /**
+ * Returns if this table needs to be logged
+ *
+ * @return bool
+ */
+ public function getLog() {
+ return static::$_log ?? FALSE;
}
/**
*/
public function getFieldSpec($fieldName) {
$fields = $this->fields();
- $fieldKeys = $this->fieldKeys();
// Support "unique names" as well as sql names
$fieldKey = $fieldName;
if (empty($fields[$fieldKey])) {
+ $fieldKeys = $this->fieldKeys();
$fieldKey = $fieldKeys[$fieldName] ?? NULL;
}
// If neither worked then this field doesn't exist. Return false.
}
}
+ /**
+ * Return a mapping from field-name to the corresponding key (as used in fields()).
+ *
+ * @return array
+ * Array(string $name => string $uniqueName).
+ */
+ public static function fieldKeys() {
+ return array_flip(CRM_Utils_Array::collect('name', static::fields()));
+ }
+
}