From da9ea65a18b2810d764a0d411abb6e4981db2590 Mon Sep 17 00:00:00 2001 From: Marcelo Boveto Shima Date: Mon, 1 Mar 2021 16:37:25 -0300 Subject: [PATCH] Adjusts for one-to-one id relationships. --- utils/entity.js | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/utils/entity.js b/utils/entity.js index 6aba665cc026..122717db8f97 100644 --- a/utils/entity.js +++ b/utils/entity.js @@ -205,19 +205,13 @@ function prepareEntityForTemplates(entityWithConfig, generator) { autoGenerate: true, readonly: true, get fieldName() { - return idCount === 1 && !relationship.otherEntity.primaryKey.composite - ? field.fieldName - : `${relationship.otherEntity.entityInstance}${field.fieldNameCapitalized}`; + return idCount === 1 ? field.fieldName : `${relationship.otherEntity.entityInstance}${field.fieldNameCapitalized}`; }, get fieldNameCapitalized() { - return idCount === 1 && !relationship.otherEntity.primaryKey.composite - ? field.fieldNameCapitalized - : `${relationship.otherEntity.entityClass}${field.fieldNameCapitalized}`; + return idCount === 1 ? field.fieldNameCapitalized : `${relationship.otherEntity.entityClass}${field.fieldNameCapitalized}`; }, get columnName() { - return idCount === 1 && !relationship.otherEntity.primaryKey.composite - ? field.columnName - : `${generator.getColumnName(relationship.relationshipName)}_${field.columnName}`; + return idCount === 1 ? field.columnName : `${generator.getColumnName(relationship.relationshipName)}_${field.columnName}`; }, get reference() { return fieldToReference(entityWithConfig, this);