Skip to content

fosrias/CFCore

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

46 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

The CFCore Project is a library of utility methods for simplifying RESTful
ORM services. The default naming conventions that should be followed are:

   table:   my_models (with field names 'my_field')
   model:   MyModel.cfc (which must be unique, application wide)
   service: MyModelsService.cfc
   
To use this library:

1. Name the folder that this stored in as CFCore and map a path to the folder 
   in the ColdFusion administrator. This makes sure the various includes 
   work correctly since using relative paths breaks down in the context of 
   using this library in a different ColdFusion application.
  
2. Copy the files Application.cfc, index.cfm and reset.cfm into the root of the 
   new application. Update the Application.cfc file accordingly.
   
3. Any ORM components must:
    a. Specify the persistent="true" tag.
    b. Specify the table="my_models" tag.
    c.  Specify their properties in standard fashion.
    d. Add the tag searchable="true" to any fields that you wish to text
       search on.
    e. Compound primary keys are automatically captured based on your property
       settings. See AORMComponent for more information.
       
4. Any RESTful service that extends AORMRESTfulService must:
    a. Define its table name.
    b. Implement the getModel function to return a string name of the
       corresponding Model.

Run index.cfm to test that everything is set up correctly and to reset the
application if you change ORM properties as they always have to be re-mapped
when changed, so you can use this page to reset the application after editing
ORM components.
       
Examples:

MyModel.cfc:

component extends="CFCore.com.fosrias.cfcore.interfaces.AORMComponent" 
          hint="The model for my_sites"
          persistent="true"
          table="sites"
          alias="MyApp.com.url.project.components.physical.MyModel" 
          style="rpc"
{
    property name="id" ormtype="integer" type="numeric" fieldtype="id" 
             generator="native";
    property name="name" type="string";
    property name="description" type="string" searchable="true";
    property name="myProperty" column="my_property";
    ...
    
    public MyModel init()
    {
        super.init();
        return this;
    }
}

MyModelsService.cfc:

component extends="CFCore.com.fosrias.cfcore.interfaces.AORMRESTfulService" 
          table="my_models"
{
    public MyModelsService function init()
    {
        super.init();
        return this;
    }
}

About

ColdFusion core library for flash remoting

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published