diff --git a/models/BaseEntity.cfc b/models/BaseEntity.cfc index 737e70f9..baae7be6 100644 --- a/models/BaseEntity.cfc +++ b/models/BaseEntity.cfc @@ -138,14 +138,8 @@ component accessors="true" { } arguments.attrs.each( function( key, value ) { - if ( variables.keyExists( "set" & retrieveAliasForColumn( arguments.key ) ) ) { - if ( ! isNullValue( arguments.key, arguments.value ) ) { - invoke( this, "set" & retrieveAliasForColumn( arguments.key ), { 1 = arguments.value } ); - } - } else { - variables._data[ retrieveColumnForAlias( key ) ] = isNull( value ) ? javacast( "null", "" ) : value; - variables[ retrieveAliasForColumn( key ) ] = isNull( value ) ? javacast( "null", "" ) : value; - } + variables._data[ retrieveColumnForAlias( key ) ] = isNull( value ) ? javacast( "null", "" ) : value; + variables[ retrieveAliasForColumn( key ) ] = isNull( value ) ? javacast( "null", "" ) : value; } ); return this; diff --git a/tests/specs/integration/BaseEntity/AttributeSpec.cfc b/tests/specs/integration/BaseEntity/AttributeSpec.cfc index cbc70c50..351c5ed8 100644 --- a/tests/specs/integration/BaseEntity/AttributeSpec.cfc +++ b/tests/specs/integration/BaseEntity/AttributeSpec.cfc @@ -15,9 +15,9 @@ component extends="tests.resources.ModuleIntegrationSpec" appMapping="/app" { expect( user.getUsername() ).toBe( "new_username" ); } ); - it( "sets attributes using the `setColumnName` magic methods during object creation", function() { + it( "does not set attributes using the `setColumnName` magic methods during object creation", function() { var referral = getInstance( "Referral" ).findOrFail( 1 ); - expect( referral.getType() ).toBeWithCase( "EXTERNAL", "type should be EXTERNAL in all caps thanks to a `setType` method on the `Referral` entity. Instead got [#referral.getType()#]." ); + expect( referral.getType() ).toBeWithCase( "external", "type should be `external` in lowercase because the `setType` method on the `Referral` entity should not be called during creation. Instead got [#referral.getType()#]." ); } ); it( "can retrieve the original attributes of a loaded entity", function() { diff --git a/tests/specs/integration/BaseEntity/UpdateAllSpec.cfc b/tests/specs/integration/BaseEntity/UpdateAllSpec.cfc index 0b49866a..bc94b830 100644 --- a/tests/specs/integration/BaseEntity/UpdateAllSpec.cfc +++ b/tests/specs/integration/BaseEntity/UpdateAllSpec.cfc @@ -14,10 +14,10 @@ component extends="tests.resources.ModuleIntegrationSpec" appMapping="/app" { } ); postA.refresh(); - // postB.refresh(); + postB.refresh(); - // expect( postA.getBody() ).toBe( "The new body" ); - // expect( postB.getBody() ).toBe( "The new body" ); + expect( postA.getBody() ).toBe( "The new body" ); + expect( postB.getBody() ).toBe( "The new body" ); } ); } ); }