Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Implicit Getters and Setters not created for me

I started playing with the new cfproperty stuff added in ColdFusion 9, but the primary piece that I want to use doesn't seem to work now in ColdFusion 10. I created the following CFC:

component displayName="Sources" {
  /**
  * @getter true
  * @setter true
  * @type numeric
  * @default 1
  **/
  property sourceid;
  /**
  * @getter true
  * @setter true
  * @type numeric
  * @default 1
  **/
  property sourcegroup;

  public any function init () {
    This.domainRegex = '\/\/(www\.)?(([A-Za-z0-9\-_]+\.?)+)';
    return this;
  }
}

When I dump the meta data for the CFC I can see the properties, but no methods created for them and I can't call getSourceId() or getSourceGroup()

like image 251
Dave Long Avatar asked Aug 03 '12 12:08

Dave Long


1 Answers

try this:

component accessors="true" displayName="Sources" {
    property name="sourceid" type="numeric" default="1";
    property name="sourcegroup" type="numeric" default="1";
    public any function init () {
        this.domainRegex = '\/\/(www\.)?(([A-Za-z0-9\-_]+\.?)+)';
        return this;
    }
}
like image 200
Sean Coyne Avatar answered Nov 11 '22 06:11

Sean Coyne