FORGEBOX Enterprise 🚀 - Take your ColdFusion (CFML) Development to Modern Times! Learn More...

quick

v2.3.0 Public


Build Status

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.

// 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 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>

Now that you've seen an example, dig in to what you can do with Quick!

Tests and Contributing

To run the tests, first clone this repo and run a box install.

Quick's test suite runs specifically on MySQL, so you will need a MySQL database to run the tests. If you do not have one, Docker provides an easy way to start one.

docker run -d --name quick -p 3306:3306 -e MYSQL_RANDOM_ROOT_PASSWORD=yes -e MYSQL_DATABASE=quick -e MYSQL_USER=quick -e MYSQL_PASSWORD=quick mysql:5

Finally, copy the .env.example file to .env and fill in the values for your database.

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.

v2.3.0

08 Jul 2019 — 15:46: 12 UTC

feat

  • BaseEntity: Add flag to ignore non-existing attributes to fill (428b31a)

v2.2.3

17 Jun 2019 — 15:06: 40 UTC

fix

  • BaseEntity: Temporary fix for extra values in data (821a054)

v2.2.2

14 Jun 2019 — 05:10: 05 UTC

perf

  • BaseEntity: Better caching of metadata (27b6ec3)

v2.2.1

14 Jun 2019 — 04:37: 21 UTC

chore

  • build: Use openjdk8 in Travis builds (d8f7d41)

other

  • *: docs: Fix Getting Started 404 (5c9eddd)

v2.2.0

29 May 2019 — 03:27: 23 UTC

feat

  • Relationships: Add fetch methods to all Relationships (61a6035)

v2.1.3

14 May 2019 — 01:57: 33 UTC

tests

  • Relationships: Prove relationship setters use the cache (953d653)

v2.1.2

07 May 2019 — 07:07: 20 UTC

fix

  • VirtualInheritance: Certify virtual inheritance support (e105f18)

v2.1.1

03 May 2019 — 22:58: 37 UTC

fix

  • Subselect: Return the entity after executing a subselect (87e5a7a)

v2.1.0

03 May 2019 — 22:25: 30 UTC

feat

  • Relationships: Relationships can be set using relationship setters (e1e21a8)
  • Relationships: Allow saving of ids as well as entities (3f30131)
  • HasMany: Many entities can be saved to a hasMany relationship at once (c9f8f47)
  • Scopes: Register global scopes for entities (995706b)
  • Subselects: Add subselect helper (cf13ddd)

fix

  • Relationships: Make mapping foreign keys optional (708506d)

v1.3.2

30 Apr 2019 — 19:52: 39 UTC

chore

v1.3.1

30 Apr 2019 — 19:43: 23 UTC

chore

docs

  • README: Document that all fields need to be mapped (ecece5c)

v1.3.0

22 Aug 2018 — 19:58: 30 UTC

chore

feat

  • BaseEntity: Enable per entity datasources and grammars (561f368)
  • KeyType: Add AssignedKey Type (897277d)

v1.2.0

19 Jul 2018 — 22:43: 54 UTC

chore

feat

  • Scopes: Allow scopes to call other scopes (07bbde1)

v1.1.2

02 Jul 2018 — 17:22: 46 UTC

chore

  • build: Set location automatically on version update (183b05a)

fix

  • BaseEntity: Only set loaded for attributes successfully retrieved from the database (665a78a)

v1.1.1

02 Jul 2018 — 16:54: 21 UTC

fix

  • Relationships: correct detach function name (5dceb17)

other

v1.1.0

06 Jun 2018 — 20:50: 16 UTC

chore

  • box.json: remove package scripts in favor of commandbox-semantic-release (aafe02a)

feat

  • attributes: better guarding against non-existent attributes (0566e35)
  • Columns: Allow attributes to set a sqltype (8c3db73)
  • Relationships: pass arguments through to relationships (5962a19)

fix

  • Update: don't include the key in the SET clause (846ff78)

other

  • *: Enable commandbox-semantic-release (e34f966)

Here are all the versions for this package. Please note that you can leverage CommandBox package versioning to install any package you like. Please refer to our managing package version guide for more information.

Version Created Last Update Published By Stable Actions
Current
2.3.0 Jul 08 2019 10:46 AM Jul 08 2019 10:46 AM
Version History
2.2.3 Jun 17 2019 10:06 AM Jun 17 2019 10:06 AM
2.2.2 Jun 14 2019 12:10 AM Jun 14 2019 12:10 AM
2.2.1 Jun 13 2019 11:37 PM Jun 13 2019 11:37 PM
2.2.0 May 28 2019 10:27 PM May 28 2019 10:27 PM
2.1.3 May 13 2019 08:57 PM May 13 2019 08:57 PM
2.1.2 May 07 2019 02:07 AM May 07 2019 02:07 AM
2.1.1 May 03 2019 05:58 PM May 03 2019 05:58 PM
2.1.0 May 03 2019 05:25 PM May 03 2019 05:25 PM
2.0.0 Apr 30 2019 02:59 PM Apr 30 2019 02:59 PM
2.0.0-beta.9 Jan 03 2019 08:44 AM Jan 03 2019 08:44 AM
2.0.0-beta.8 Jan 02 2019 10:03 AM Jan 02 2019 10:03 AM
2.0.0-beta.7 Dec 29 2018 04:23 PM Dec 29 2018 04:23 PM
2.0.0-beta.6 Dec 28 2018 12:23 AM Dec 28 2018 12:23 AM
2.0.0-beta.5 Dec 14 2018 08:51 AM Dec 14 2018 08:51 AM
2.0.0-beta.4 Dec 12 2018 10:18 PM Dec 12 2018 10:18 PM
2.0.0-beta.3 Nov 30 2018 08:36 AM Nov 30 2018 08:36 AM
2.0.0-beta.2 Nov 27 2018 11:27 PM Nov 27 2018 11:27 PM
2.0.0-beta.14 Apr 12 2019 10:47 AM Apr 12 2019 10:47 AM
2.0.0-beta.13 Apr 11 2019 10:11 PM Apr 11 2019 10:11 PM
2.0.0-beta.12 Apr 09 2019 09:51 PM Apr 09 2019 09:51 PM
2.0.0-beta.11 Apr 07 2019 06:48 PM Apr 07 2019 06:48 PM
2.0.0-beta.10 Apr 03 2019 09:20 PM Apr 03 2019 09:23 PM
2.0.0-beta.1 Sep 17 2018 09:11 PM Sep 17 2018 09:11 PM
1.3.2 Apr 30 2019 02:52 PM Apr 30 2019 02:52 PM
1.3.1 Apr 30 2019 02:43 PM Apr 30 2019 02:43 PM
1.3.0 Aug 22 2018 02:58 PM Aug 22 2018 02:58 PM
1.2.0 Jul 19 2018 05:43 PM Jul 19 2018 05:43 PM
1.1.2 Jul 02 2018 12:22 PM Jul 02 2018 12:22 PM
1.1.1 Jul 02 2018 11:54 AM Jul 02 2018 11:54 AM
1.1.0 Jun 06 2018 03:50 PM Jun 06 2018 03:50 PM
1.0.0 Apr 25 2018 11:02 PM Apr 25 2018 11:02 PM

 

No collaborators yet.
     
  • Apr 25 2018 11:02 PM
  • Jul 08 2019 10:46 AM
  • 989
  • 0
  • 1008