quick icon indicating copy to clipboard operation
quick copied to clipboard

Allow appendVirtualAttribute to provide a default

Open jclausen opened this issue 3 years ago • 0 comments

Because virtual attributes at detached from the properties of the component, there is no way to specify a default when declaring one, other than a setter after declaring the virtual attribute. This is important, for example, when creating a new entity where the virtual attribute value might be know ( e.g. 0 or false ) and allows an API to save and mementify entity without having to refresh the entity from the database after the save.

My suggestion would be to move the excludeFromMemento argument to the third position ( a breaking change ) which would allow a more fluent declaration:

qb.selectRaw( "SELECT count(*) from myRelationship JOIN #tableName()# ON myRelationship.FK_myEntity = #tableName()#.id as myVirtualAttribute" );
appendVirtualAttribute( "myVirtualAttriubute", 0 );

jclausen avatar Aug 21 '20 13:08 jclausen