From 81aedbb48504a14ac87b1be8cae5f587bbfd3556 Mon Sep 17 00:00:00 2001 From: Eric Peterson Date: Fri, 31 May 2024 15:23:15 -0600 Subject: [PATCH] fix(Relationships): Fix naming collision with `newEntity` function and variable name. --- models/Relationships/BelongsTo.cfc | 6 +++--- models/Relationships/BelongsToThrough.cfc | 6 +++--- models/Relationships/HasOne.cfc | 6 +++--- models/Relationships/HasOneThrough.cfc | 6 +++--- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/models/Relationships/BelongsTo.cfc b/models/Relationships/BelongsTo.cfc index 81ca0fe..d902118 100644 --- a/models/Relationships/BelongsTo.cfc +++ b/models/Relationships/BelongsTo.cfc @@ -219,14 +219,14 @@ component */ public array function initRelation( required array entities, required string relation ) { arguments.entities.each( function( entity ) { - var newEntity = newDefaultEntity(); + var defaultEntity = newDefaultEntity(); if ( structKeyExists( arguments.entity, "isQuickEntity" ) ) { arguments.entity.assignRelationship( relation, - isNull( newEntity ) ? javacast( "null", "" ) : newEntity + isNull( defaultEntity ) ? javacast( "null", "" ) : defaultEntity ); } else { - arguments.entity[ relation ] = isNull( newEntity ) ? {} : newEntity.getMemento(); + arguments.entity[ relation ] = isNull( defaultEntity ) ? {} : defaultEntity.getMemento(); } } ); return arguments.entities; diff --git a/models/Relationships/BelongsToThrough.cfc b/models/Relationships/BelongsToThrough.cfc index 702d4fd..b4645be 100644 --- a/models/Relationships/BelongsToThrough.cfc +++ b/models/Relationships/BelongsToThrough.cfc @@ -262,14 +262,14 @@ component extends="quick.models.Relationships.BaseRelationship" { */ public array function initRelation( required array entities, required string relation ) { return arguments.entities.map( function( entity ) { - var newEntity = newDefaultEntity(); + var defaultEntity = newDefaultEntity(); if ( structKeyExists( arguments.entity, "isQuickEntity" ) ) { arguments.entity.assignRelationship( relation, - isNull( newEntity ) ? javacast( "null", "" ) : newEntity + isNull( defaultEntity ) ? javacast( "null", "" ) : defaultEntity ); } else { - arguments.entity[ relation ] = isNull( newEntity ) ? {} : newEntity.getMemento(); + arguments.entity[ relation ] = isNull( defaultEntity ) ? {} : defaultEntity.getMemento(); } return arguments.entity; } ); diff --git a/models/Relationships/HasOne.cfc b/models/Relationships/HasOne.cfc index 55656b4..951c20c 100644 --- a/models/Relationships/HasOne.cfc +++ b/models/Relationships/HasOne.cfc @@ -57,14 +57,14 @@ component extends="quick.models.Relationships.HasOneOrMany" { */ public array function initRelation( required array entities, required string relation ) { return arguments.entities.map( function( entity ) { - var newEntity = newDefaultEntity(); + var defaultEntity = newDefaultEntity(); if ( structKeyExists( arguments.entity, "isQuickEntity" ) ) { arguments.entity.assignRelationship( relation, - isNull( newEntity ) ? javacast( "null", "" ) : newEntity + isNull( defaultEntity ) ? javacast( "null", "" ) : defaultEntity ); } else { - arguments.entity[ relation ] = isNull( newEntity ) ? {} : newEntity.getMemento(); + arguments.entity[ relation ] = isNull( defaultEntity ) ? {} : defaultEntity.getMemento(); } return arguments.entity; } ); diff --git a/models/Relationships/HasOneThrough.cfc b/models/Relationships/HasOneThrough.cfc index de37a4f..4ba9cd4 100644 --- a/models/Relationships/HasOneThrough.cfc +++ b/models/Relationships/HasOneThrough.cfc @@ -53,14 +53,14 @@ component extends="quick.models.Relationships.HasOneOrManyThrough" { */ public array function initRelation( required array entities, required string relation ) { return arguments.entities.map( function( entity ) { - var newEntity = newDefaultEntity(); + var defaultEntity = newDefaultEntity(); if ( structKeyExists( arguments.entity, "isQuickEntity" ) ) { arguments.entity.assignRelationship( relation, - isNull( newEntity ) ? javacast( "null", "" ) : newEntity + isNull( defaultEntity ) ? javacast( "null", "" ) : defaultEntity ); } else { - arguments.entity[ relation ] = isNull( newEntity ) ? {} : newEntity.getMemento(); + arguments.entity[ relation ] = isNull( defaultEntity ) ? {} : defaultEntity.getMemento(); } return arguments.entity; } );