Skip to content

Commit

Permalink
refactor(BaseEntity): Remove virtual inheritance
Browse files Browse the repository at this point in the history
Virtual Inheritance was a rarely used option that added increased
complexity and code paths to the code.  We are removing it in favor
of traditional inheritance.

BREAKING CHANGE:  Virtual Inheritance (using a `quick` annotation)
has been removed and needs to be migrated to traditional inheritance
(`extends="quick.models.BaseEntity"`).
  • Loading branch information
elpete committed Apr 29, 2020
1 parent 24ad429 commit 3b026b1
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 44 deletions.
4 changes: 0 additions & 4 deletions ModuleConfig.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,6 @@ component {
]
};

interceptors = [
{ class="#moduleMapping#.interceptors.QuickVirtualInheritanceInterceptor" }
];

binder.map( "quick.models.BaseEntity" )
.to( "#moduleMapping#.models.BaseEntity" );

Expand Down
22 changes: 0 additions & 22 deletions interceptors/QuickVirtualInheritanceInterceptor.cfc

This file was deleted.

28 changes: 13 additions & 15 deletions models/BaseEntity.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -2818,21 +2818,19 @@ component accessors="true" {
* @return void
*/
function instanceReady() {
if ( entityName() != "BaseEntity" ) {
param this.memento = {};
structAppend(
this.memento,
{
"defaultIncludes" : retrieveAttributeNames(),
"defaultExcludes" : [],
"neverInclude" : [],
"defaults" : {},
"mappers" : {},
"trustedGetters" : true,
"ormAutoIncludes" : false
}
);
}
param this.memento = {};
structAppend(
this.memento,
{
"defaultIncludes" : retrieveAttributeNames(),
"defaultExcludes" : [],
"neverInclude" : [],
"defaults" : {},
"mappers" : {},
"trustedGetters" : true,
"ormAutoIncludes" : false
}
);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion tests/resources/app/models/User.cfc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
component quick {
component extends="quick.models.BaseEntity" {

property name="id";
property name="username";
Expand Down
4 changes: 2 additions & 2 deletions tests/resources/app/models/externalThing.cfc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
component quick table="externalThings" {
component extends="quick.models.BaseEntity" table="externalThings" {

property name="thingID";
property name="externalID"; // the external vendor foreign key
Expand All @@ -9,4 +9,4 @@ component quick table="externalThings" {

function users() { return hasMany( relationName = "User", foreignKey = "externalID", localKey = "externalID" ); }

}
}

0 comments on commit 3b026b1

Please sign in to comment.