Copy link to clipboard
Copied
I am adopting the use of creating a variables.instance (I use 'variables.my') structure to separate instance data from the object, however I have a question when it comes to ColdFusion creating implicit getters and setters based on that object's defined properties.
BEFORE, if I had a Name property, CF would create getName() and setName() for me, and it would update the variables.Name private variable accordingly in each. But now that my variables are being stored in 'variables.my.Name', does this mean I can no longer use ColdFusion's implicit getters and setters? (because it would improperly be attempting to execute getName and be looking for variables.Name, when that data now exists in variables.my.Name?
Are there any methodologies around that allow me to utilize CF's implicit getters/setters while using this 'my' instance variable and have them work with one another?
Copy link to clipboard
Copied
Yes, nesting the component's variables into a custom structure (like variables.instance or variables.my) will break the implicit getter/setter functionality. You'll have to explicitly create getter and setter methods.
-Carl V.
Copy link to clipboard
Copied
Thanks for the confirmation Carl.
How cool, then, would it be if ColdFusion 11 supported something like:
<cfcomponent
accessors="true"
implicitpropertyprefix="my."
...
That way I could specify "my." as the property prefix and when it goes to create those implicit getters and settings, it will concatenate that into 'variables.my.' as the prefix when it alters property values or returns them.
Copy link to clipboard
Copied
Sounds like a great Enhancement Request to put in the bug tracker.
-Carl V.
Copy link to clipboard
Copied
To the bug tracker! *rushes off*
** UPDATE ** Hmm, seems cfbugs.adobe.com is resetting the connection repeatedly. <philosophical>Can one submit a bug into a bug reporting system that is experiencing a bug?</philosophical>