Skip to content

Commit

Permalink
bug fixes, enhancements and refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
aliaspooryorik committed Jul 25, 2013
1 parent cfbbc41 commit 8b86848
Show file tree
Hide file tree
Showing 18 changed files with 413 additions and 37 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
/*.tmproj
/ivy*
/eclipse
settings.xml

# default HSQL database files for production mode
/prodDb.*
Expand Down
30 changes: 23 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,30 @@ https://github.com/ColdBox/coldbox-platform/blob/master/system/orm/hibernate/Bas
Status
----------------------------------------------------------------------

v0.7
some bug fixes and enhancements
cleaned up project to make it more obvious how it works

v0.6
it works, but hasn't been battle tested. Subject to API changes
Use at your own risk :)

Status
----------------------------------------------------------------------

Requirements
----------------------------------------------------------------------

Railo 3.3.4 or higher
ColdFusion 9 or higher

Note: if you want to use new( memento ) then you need ColdFusion 10 or
Railo 4.

Installing
----------------------------------------------------------------------

The minimal install is just to use the AbstractDAO.cfc. There is an optional
DAOFactory.cfc which creates virtual or concrete DAOs on the fly. You can put
these files wherever you like as long as they are in the same directory as each
other.

Usage
----------------------------------------------------------------------
Expand All @@ -52,12 +64,12 @@ If you want to create a virtual DAO then simply pass in the entity name
// create a virtual DAO for the Author entity
AuthorDAO = new AbstractDAO( 'Author' );

### Creating Concrete DAOs
### Using With Concrete DAOs

If you want to extend the AbstractDAO with your own concrete DAOs then your
DAO would need to be instantiated like so:

component extends="model.abstract.AbstractDAO" {
component extends="cfmlorm.lib.AbstractDAO" {

/* CONSTRUCTOR
----------------------------------------------------------------- */
Expand Down Expand Up @@ -135,7 +147,8 @@ The choice is yours!

### Methods

These are the methods you can call on the virtual / concrete DAO. I need to document these a bit better :)
These are the methods you can call on the virtual / concrete DAO. I suggest you look at the
unit tests to see how they work as I need to document these a bit better :)

// get one by id. returns null if no match
get( id )
Expand Down Expand Up @@ -171,9 +184,12 @@ These are the methods you can call on the virtual / concrete DAO. I need to docu
// save
save( obj )

// where
// where - returns array unless unique is true when it will return an object
where( string clause )
where( string clause, struct params )
where( string clause, array params )
where( string clause, boolean unique )
where( string clause, boolean unique, struct queryOptions )

// where examples:
where( "id > :id and active = :active", {id=1,active=true})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -212,8 +212,11 @@ component {
var params = {};
var result = [];
var hasWhereClause = false;
param name="arguments.likeQuery" default="false";

if ( !StructKeyExists(arguments, "likeQuery") ){
arguments.likeQuery = false;
}

if ( StructKeyExists( arguments, "filtercriteria" ) && StructCount( arguments.filtercriteria ) ) {
for ( var key in arguments.filtercriteria ){
if ( !hasWhereClause ){
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
3 changes: 3 additions & 0 deletions _tests/Application.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ component {
this.applicationroot = ReReplace( getDirectoryFromPath( getCurrentTemplatePath() ), "_tests.$", "", "all" );
this.name = ReReplace( "[^W]", this.applicationroot & "_tests", "", "all" );

this.mappings[ "/lib" ] = this.applicationroot & "lib/";
this.mappings[ "/model" ] = this.applicationroot & "model/";
this.mappings[ "/_tests" ] = this.applicationroot & "_tests/";

Expand All @@ -16,6 +17,8 @@ component {
};

function onRequestStart(){
// writedump(this.mappings);
// abort;
ORMReload();
}

Expand Down
2 changes: 1 addition & 1 deletion _tests/BaseTestCase.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ component extends="mxunit.framework.TestCase" {
( id, forename, surname, dob )
VALUES
( 1, 'John', 'Whish', '1990-04-22' ),
( 2, 'Richard', 'Whish', '1980-04-22' ),
( 2, 'Theo', 'Whish', '1980-04-22' ),
( 3, 'Fred', 'Bloggs', '1970-04-22' ),
( 4, 'Sam', 'Smith', '1960-04-22' )
" );
Expand Down
Loading

0 comments on commit 8b86848

Please sign in to comment.