You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
component table="RMME_A" extends="quick.models.BaseEntity" accessors=true {
property name="id_a" type="numeric" sqltype="int";
property name="v" type="string" sqltype="varchar";
variables._key = "id_a";
function keyType() {
return variables._wirebox.getInstance( "NullKeyType@quick" ); // the key comes from Stripe and is not generated locally
}
function scopeWithComputedValue( qb ) {
qb.appendVirtualAttribute( "computedValue" )
qb.selectRaw("'the value in the [v] column is: <<<' + [v] + '>>>' as computedValue")
}
}
///////
queryExecute("
drop table if exists rmme_a;
create table rmme_a(id_a int, v varchar(max));
")
getInstance("RMME_A").create({id_a:1, v: "AAA"})
x = getInstance("RMME_A").whereID_A(1).withComputedValue().firstOrFail()
writedump(x.getComputedValue()) // "the value in the [v] column is: <<<AAA>>>"
x.update({v: "BBB"})
x = x.refresh()
writedump(x.getV()) // "BBB", ok
writedump(x.getComputedValue()) // "the value in the [v] column is: <<<AAA>>>", computed value out of sync with actual value after a refresh
x = getInstance("RMME_A").whereID_A(1).withComputedValue().firstOrFail()
writedump(x.getComputedValue()) // "the value in the [v] column is: <<<BBB>>>", ok after full firstOrFail reload
abort;
This can lead to entities winding up in inconsistent states, where computed values from scopes are no longer in sync with actually refreshed data.
This behavior appears unchanged from Quick4, maybe it just needs to be documented.
The text was updated successfully, but these errors were encountered:
This can lead to entities winding up in inconsistent states, where computed values from scopes are no longer in sync with actually refreshed data.
This behavior appears unchanged from Quick4, maybe it just needs to be documented.
The text was updated successfully, but these errors were encountered: