quick icon indicating copy to clipboard operation
quick copied to clipboard

Return nulls instead of throwing an error when attempting to access a relationship on an unloaded entity

Open jclausen opened this issue 4 years ago • 0 comments

Quick's behavior is to throw a hard error when attempting to access a relational property on an unloaded entity.

It is often common to perform post-fill checks on properties to set them to their defaults. For example:

user.new( rc );
if( isNull( user.getCreatedBy() ) ){  // will throw a hard error
   user.setCreatedBy( getCurrentUser() );
}

Suggestion would be to add a module setting or change the default behavior to simply return null when the relationship is requested and it has not been associated.

This also promotes better ease of handling entity CRUD interception points, by not requiring knowledge of the filled values.

jclausen avatar Nov 11 '20 16:11 jclausen