private function normalizeFieldName($field)
{
if (is_object($field) && isset($field->_trackableTrait) && $field->owner === $this) {
$field = $field->short_name;
}
if (!is_string($field) || $field === '' || is_numeric($field[0])) {
throw new Exception(['Incorrect specification of field name', 'arg' => $field]);
}
if ($this->only_fields) {
if (!in_array($field, $this->only_fields)) {
throw new Exception(['Attempt to use field outside of those set by onlyFields', 'field' => $field, 'only_fields' => $this->only_fields]);
}
}
if ($this->strict_field_check && !isset($this->elements[$field])) {
throw new Exception(['Field is not defined inside a Model', 'field' => $field, 'model' => $this]);
}
return $field;
}