Quick ORM
Search…
Introduction
Quick logo

A CFML ORM Engine

Why?

Quick was built out of lessons learned and persistent challenges in developing complex RDBMS applications using built-in Hibernate ORM in CFML.
  • Hibernate ORM error messages often obfuscate the actual cause of the error
    because they are provided directly by the Java classes.
  • Complex CFML Hibernate ORM applications can consume significant memory and
    processing resources, making them cost-prohibitive and inefficient when used
    in microservices architecture.
  • Hibernate ORM is tied to the engine releases. This means that updates come
    infrequently and may be costly for non-OSS engine users.
  • Hibernate ORM is built in Java. This limits contributions from CFML
    developers who don't know Java or don't feel comfortable contributing to a
    Java project.
  • Hibernate ORM doesn't take advantage of a lot of dynamic- and
    meta-programming available in CFML. (Tools like CBORM have helped to bridge
    this gap.)
We can do better.

What?

Quick is an ORM (Object Relational Mapper) written in CFML for CFML. It provides an ActiveRecord implementation for working with your database. With it you can map database tables to components, create relationships between components, query and manipulate data, and persist all your changes to your database.

Prerequisites

You need the following configured before using Quick:
  • Configure a default datasource in your CFML engine
  • ColdBox 4.3+
  • Add a mapping for quick in your Application.cfc
  • Configure your BaseGrammar in config/ColdBox.cfc
See Getting Started for more details.

Supported Databases

Quick supports all databases supported by qb.

Example

Here's a "quick" example to whet your appetite.
We'll show the database structure using a migrations file. This isn't required to use quick, but it is highly recommended.
1
// 2017_11_10_122835_create_users_table.cfc
2
component {
3
4
function up() {
5
schema.create( "users", function( table ) {
6
table.increments( "id" );
7
table.string( "username" ).unique();
8
table.string( "email" ).unique();
9
table.string( "password" );
10
table.timestamp( "createdDate" );
11
table.timestamp( "updatedDate" );
12
} );
13
}
14
15
}
Copied!
1
// User
2
component extends="quick.models.BaseEntity" {
3
4
// the name of the table is the pluralized version of the model
5
// all fields in a table are mapped by default
6
// both of these points can be configured on a per-entity basis
7
8
}
Copied!
1
// handlers/Users.cfc
2
component {
3
4
// /users/:id
5
function show( event, rc, prc ) {
6
// this finds the User with an id of 1 and retrieves it
7
prc.user = getInstance( "User" ).findOrFail( rc.id );
8
event.setView( "users/show" );
9
}
10
11
}
Copied!
1
<!-- views/users/show.cfm -->
2
<cfoutput>
3
<h1>Hi, #prc.user.getUsername()#!</h1>
4
</cfoutput>
Copied!
Now that you've seen an example, dig in to what you can do with Quick!

Prior Art, Acknowledgements, and Thanks

Quick is backed by qb. Without qb, there is no Quick.
Quick is inspired heavily by Eloquent in Laravel. Thank you Taylor Otwell and the Laravel community for a great library.
Development of Quick is sponsored by Ortus Solutions. Thank you Ortus Solutions for investing in the future of CFML.

Discussion & Help

The Box products community for further discussion and help can be found here: https://community.ortussolutions.com/c/communities/quick-orm/23
Last modified 9mo ago