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
Related to this post on the Ortus community forums.
It would be great if, when requesting relationship data from a non-loaded (new) entity, Quick would return null (or an empty array where appropriate) just like if you performed the same operation from a loaded entity. This behavior should be more intuitive and also better follows the null object pattern.
Here's a simple example of how one might use this new change in Quick:
// Post.cfc
component
extends="quick.models.BaseEntity"
accessors="true"
{
// Post belongs to an Author
function author() {
return belongsTo( "User" );
}
}
// Posts.cfc Handler
function index( event, rc, prc ) {
// Get an existing entity, or return a new one if not found
prc.post = getInstance( "Post" )
.firstOrCreate( rc.id );
// return the memento with the author (it will either be null or populated)
return prc.post.getMemento( "author" );
}
The text was updated successfully, but these errors were encountered:
Related to this post on the Ortus community forums.
It would be great if, when requesting relationship data from a non-loaded (new) entity, Quick would return null (or an empty array where appropriate) just like if you performed the same operation from a loaded entity. This behavior should be more intuitive and also better follows the null object pattern.
Here's a simple example of how one might use this new change in Quick:
The text was updated successfully, but these errors were encountered: