Skip to content

Commit

Permalink
fix(Relationships): Fix naming collision with newEntity function an…
Browse files Browse the repository at this point in the history
…d variable name.
  • Loading branch information
elpete committed May 31, 2024
1 parent ba3a2f4 commit 81aedbb
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
6 changes: 3 additions & 3 deletions models/Relationships/BelongsTo.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 3 additions & 3 deletions models/Relationships/BelongsToThrough.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
} );
Expand Down
6 changes: 3 additions & 3 deletions models/Relationships/HasOne.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
} );
Expand Down
6 changes: 3 additions & 3 deletions models/Relationships/HasOneThrough.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
} );
Expand Down

0 comments on commit 81aedbb

Please sign in to comment.