static function getFieldNameAlias($field) { $mod = self::loadModification($field); if (substr($field['field_name'], -3) == '_id') { if ($name = LsVersionable::getRelationAliasByModelAndFieldName($mod['object_model'], $field['field_name'])) { return $name; } } return null; }
public function getRelationAliasByFieldName($fieldName) { $object = $this->getInvoker(); $table = $object->getTable(); foreach ($table->getRelations() as $name => $relation) { if ($relation->getLocalFieldName() == $fieldName) { return $name; } } foreach ($this->_extensionObjects as $name => $object) { if ($name = LsVersionable::getRelationAliasByRecordAndFieldName($object, $fieldName)) { return $name; } } return null; }