public function getReferencedField($objectName, $fieldName, array & $excludedFieldNameParts = array(), $objectReferencesOnly = true)
    {
        $foundFieldName = null;
        $fieldNameParts = explode('_', $fieldName);
        $excludedFieldNameParts = array();
        $initial = false;
        while (count($fieldNameParts) > 0) {
            if ($initial === true) {
                array_unshift($excludedFieldNameParts, array_pop($fieldNameParts));
            }

            $fieldName = implode("_", $fieldNameParts);
            if ($this->hasField($objectName, $fieldName)) {
                $foundFieldName = $fieldName;
                break;
            }

            $initial = true;
        }

        if (!empty($foundFieldName) && is_array($fieldConfiguration = $this->getField($objectName, $foundFieldName)) && ($objectReferencesOnly === false || $this->isObjectReference($fieldConfiguration['datatype']))) {
            return $fieldConfiguration;
        }
    }