Is there a way to make isDevMode, devModeToEmailAddress, devModeFromEmailAddress to be private properites?
Code:
/**
* email
* @accessors true
*/
component email output="false" hint="This is email object." {
/* properties */
property name="toEmailAddress" type="string";
property name="fromEmailAddress" type="string";
property name="subject" type="string";
property name="body" type="string";
property name="attachments" type="array";
/*
private isDevMode
private devModeToEmailAddress
private devModeFromEmailAddress
*/
}
You can add
setter="false"andgetter="false"to prevent getters and setters, but you can’t restrict access to the properties directly. Your best bet is put those into your constructor in the component’s local scope.Then, when you need to use those, just reference
variables.isDevModein any function to pick up the value. If you need to set those at runtime, you can set them in theinit()method for your function. I usually do it like this:Then, any time I need those values I just get
variables.Instance.isDevMode. I also create a genericget()method that will return thevariables.instanceso I can see what’s in there.But because these are in the components local variables scope, they can’t be modified from outside the component.