arrow-left

All pages
gitbookPowered by GitBook
1 of 1

Loading...

Introduction

hashtag
A CFML ORM Engine

Quick is an ORM (Object Relational Mapper) written in CFML for CFML. It provides an ActiveRecordarrow-up-right and Service-based 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.

circle-info

Curious why you would want to use Quick?

hashtag
Prerequisites

You need the following configured before using Quick:

  • Configure a default datasource in your CFML engine

  • ColdBox 5+

  • Add a mapping for quick in your Application.cfc

See for more details.

hashtag
Supported Databases

Quick supports all databases supported by .

hashtag
Example

Here's a "quick" example to whet your appetite.

We'll show the database structure using a . This isn't required to use quick, but it is highly recommended.

Now that you've seen an example, with Quick!

hashtag
Prior Art, Acknowledgements, and Thanks

Quick is backed by . Without qb, there is no Quick.

Quick is inspired heavily by . Thank you Taylor Otwell and the Laravel community for a great library.

Development of Quick is sponsored by . Thank you Ortus Solutions for investing in the future of CFML.

Development of Quick 3.0.0 was heavily sponsored and tested by .

Configure your BaseGrammar in config/ColdBox.cfc
Check out our explanation here.
Getting Started
qbarrow-up-right
migrations filearrow-up-right
dig in to what you can do
qbarrow-up-right
Eloquent in Laravelarrow-up-right
Ortus Solutionsarrow-up-right
AvoyaTravelarrow-up-right
// 2017_11_10_122835_create_users_table.cfc
component {

    function up() {
        schema.create( "users", function( table ) {
            table.increments( "id" );
            table.string( "username" ).unique();
            table.string( "email" ).unique();
            table.string( "password" );
            table.timestamp( "createdDate" );
            table.timestamp( "updatedDate" );
        } );
    }

}
// User
component extends="quick.models.BaseEntity" {

    // the name of the table is the pluralized version of the model
    // this would be `users`
    
    // fields in a table should be mapped as properties
    property name="username";
    
    // both of these points can be configured on a per-entity basis

}
// handlers/Users.cfc
component {

    // /users/:id
    function show( event, rc, prc ) {
        // this finds the User with an id of 1 and retrieves it
        prc.user = getInstance( "User" ).findOrFail( rc.id );
        event.setView( "users/show" );
    }

}
<!-- views/users/show.cfm -->
<cfoutput>
    <h1>Hi, #prc.user.getUsername()#!</h1>
</cfoutput>