Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion models/BaseEntity.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -558,7 +558,12 @@ component accessors="true" {
*/
private void function syncVariablesScopeWithData() {
for ( var key in retrieveAttributeNames( withVirtualColumns = false ) ) {
if ( variables.keyExists( key ) && !isReadOnlyAttribute( key ) ) {
var column = retrieveColumnForAlias( key );
if (
variables.keyExists( key ) &&
!isReadOnlyAttribute( key ) &&
( variables._data.keyExists( column ) || !isNull( variables[ key ] ) )
) {
assignAttribute( key, variables[ key ] );
}
}
Expand Down
9 changes: 9 additions & 0 deletions tests/specs/integration/BaseEntity/MetadataSpec.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,15 @@ component extends="tests.resources.ModuleIntegrationSpec" {
},
skip = !server.keyExists( "boxlang" )
);

it(
title = "does not persist uninitialized BoxLang accessor values",
body = function() {
var user = getInstance( "User" );
expect( user.retrieveAttributesData() ).notToHaveKey( "created_date" );
},
skip = !server.keyExists( "boxlang" )
);
} );
} );
}
Expand Down
Loading