mirror of
https://github.com/alextselegidis/easyappointments.git
synced 2024-11-28 10:53:40 +03:00
The base model knows how to map an API resource field to a DB field.
This commit is contained in:
parent
c390a6552a
commit
ea659ccb9f
1 changed files with 12 additions and 0 deletions
|
@ -178,4 +178,16 @@ class EA_Model extends CI_Model {
|
||||||
return in_array($field, $fields);
|
return in_array($field, $fields);
|
||||||
}, ARRAY_FILTER_USE_KEY);
|
}, ARRAY_FILTER_USE_KEY);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the DB field name based on an API field name.
|
||||||
|
*
|
||||||
|
* @param string $api_field API resource key.
|
||||||
|
*
|
||||||
|
* @return string|null Returns the column field or null if non found.
|
||||||
|
*/
|
||||||
|
public function db_field(string $api_field): ?string
|
||||||
|
{
|
||||||
|
return $this->api_resource[$api_field] ?? NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue