tags:

views:

32

answers:

1

When I use CF9's ORM feature and generate an explict setter for my ORM CFC, is there anyway to call the default funcitionailty of the ORM CFC after i have done the work needed in the method. For example i am looking for something like this. Obviosuly the code will not run , and super is the wrong concept since the ORM CFC isnt inherting anything, but thats the type of functionality I am looking for.

public void setMovie(String movie){
if(movie == "inception"){
ORMCFC.super().setMovie("Greatest movie ever made")
}else{
ORMCFC.super().setMovie(movie)
}
A: 

In your model CFC for the ORM you can specify additional "decorator" functions.

component persistent="true" table="Movie"  schema="dbo" output="false"
{
    /* properties */

    property name="MovieNo" column="MovieNo" type="numeric" ormtype="double" fieldtype="id" ; 
    property name="Name" column="Name" type="string" ormtype="string" ; 

    /* decorator */
    public void function setMovie(name)
    {
        if(name == "inception"){
            setName("Greatest movie ever made")
        }else{
            setName(name)
        }

    }
}

Otherwise if you need to (using your example) setMovie() you will need to do an EntityLoad or create a new entity to set a value to.

jarofclay
Ohh okay thats a perfect way! Why didn't I think of that :)!
Faisal Abid