2
votes

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)
}
1
I find your example code distracting. Maybe if you gave a practical example it would be easier to understand exactly what you want to do... unless you're writing an app about movies and want to change "inception" to "greatest movie ever made". - Adam Tuttle

1 Answers

0
votes

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.