Skip to content
Open
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
6 changes: 6 additions & 0 deletions tests/resources/app/models/AliasedUsernameUser.cfc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
component extends="quick.models.BaseEntity" accessors="true" table="users" {

property name="id";
property name="username" column="first_name" sqltype="cf_sql_varchar";

}
8 changes: 8 additions & 0 deletions tests/specs/integration/BaseEntity/AttributeSpec.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,14 @@ component extends="tests.resources.ModuleIntegrationSpec" {
} );
} );

it( "uses an explicit column when the property name is also a database column", function() {
var user = getInstance( "AliasedUsernameUser" ).findOrFail( 1 );

expect( user.getUsername() ).toBe( "Eric" );
expect( user.retrieveAttributesData() ).toHaveKey( "first_name" );
expect( user.retrieveAttributesData() ).notToHaveKey( "username" );
} );

// https://github.com/coldbox-modules/quick/issues/127
it( "can clear an attribute", () => {
var elpete = getInstance( "User" ).findOrFail( 1 );
Expand Down
Loading