Thanks Nathan, that's good to know. I will definitely have to look deeper
into that. I have been using ColdSpring in a common way for so long that I
have not looked over the documentation in a couple years. I may have had
the ability all along and not known it. Thanks again!
On Fri, Feb 6, 2015
I tried to answer this twice but neither of my previous emails went
through. I'm trying from another account.
Byron's last example passing the value from the child object to the parent
definitely works. I'm not sure what's in your Util class, but the name of
it seems to imply using it as a
Byron,
This is pretty much what I was thinking that I had to do, but was hoping to
not have to explicitly call the super.init() method for every class that
extends the base class. I'm just not sure if what I am trying to do is even
possible.
On Fri, Feb 6, 2015 at 2:23 PM, Byron Mann
You're using ColdSpring and you say CS is not autowiring the field on a
base class? It's supposed to, FYI, it just is. If it does not, you can do
it explicitly in your xml file (if you use the DefaultXMLBeanFactory.cfc).
Also, make sure the autowire option is on, at least for this object if not
Hi Jon,
No, the utility class is not dependent on the base class. The base class
has some universal methods that handle things like performing common
preInsert and preUpdate ORM methods across all my persistent objects. My
utility class has some common methods that I use for such things as
Dean,
Byron's suggestion is a good one, and the right way to go unless you use an
IoC container. It's an object-oriented programming idea where, when you
come to the point of not wanting to instantiate all your objects. You
invert the control of creating away from what normally creates them into
This might work, if I'm understanding.
component name='baseClass' {
variables.utilClass = '';
public any function init(utilClass utilClass){
variables.utilClass = arguments.utilClass;
}
}
In your derived class you can do this.
component extends='baseClass'{
public any function
Dean,
Is your utility class dependent on the the base class (e.g. - does it use
âthisâ or the variables scope)? Â If so, then you have a couple of
different ways you can go:
1) use it as a mixin inside your component{} , and forego the class wrapper for
the Utility methods entirely:
Thanks Nathan,
I am familiar with IoC and am using ColdSpring for this very purpose.
However, it doesn't really work in this situation because the base class is
never called directly though the beanfactory. The bean that is extending
the base class may, but not the baseclass itself. This is my
Think you might want something like this in your base cfc? I think you'd
not want the UtilClass to inherit the base class however, or this would
lead to a circular reference and probably kill the app.
component name='baseClass' {
variables.utilClass = new UtilClass();
}
On Fri, Feb 6, 2015
Thanks Byron,
I wasn't wanting my utility class to inherit my base class, I am wanting to
inject the utility class into the base class. I'm trying to get away from
explicitly defining the utility class from within the base class. Since the
base class is not called directly, I don't know how to
11 matches
Mail list logo