[wirebox-1.7] Extending classes to support legacy and provide common injected properties

So, still on a legacy migration research quest. Overcame many obstacles using Wirebox. Now that I have some things working, I’m finding that I’m injecting identical properties into my test classes and while that’s working, it’s indicating a pattern and I’d rather not have to change every legacy class to inject these, particularly since during this process I might change them…so I figured ok, let’s just extend every class and put the most common properties there. So I drop these common properties, put them in “model.abstracts.commonbase”, extend my class with that abstract and…

my common properties seem to disappear from my debugging output:

PROPERTIES

iaccountid | 1000 |

  • | - |
    vchhost | local.v12.com |
    benabled | 1 |
    bdefault | 1 |
    slayout | [empty string] |

…where there should be three other properties there from the inheritance. However, if I output the value directly (object.getDS() for example, DS being one of the properties), the values are there, injected as they should have been…it seems at least.

When I started writing this, the question was going to be why aren’t the properties available…which I assumed because they were not showing up in the object dump. But now, I think I can see that they exist. I even added a memento function to my abstract class and it too returns everything in the created class instance but not from the abstract.

Why?

Not sure if I’m following, but injected properties won’t show up in the “properties” portion of the dump AFAIK. The default injection scope is variables and that’s were you need to look for them. Also make sure you’re looking for your injected properties after WireBox is fully finished. init() and the “pseudo constructor” are called prior to inject, but onDIComplete(0 is called after.

Thanks!

~Brad

ColdBox Platform Evangelist
Ortus Solutions, Corp

E-mail: brad@coldbox.org
ColdBox Platform: http://www.coldbox.org
Blog: http://www.codersrevolution.com

ah yes…it does default to variables…I see what’s happening. I’ve not had to do this before, change the scope. So a quick description of “property” with injection is that it’s not actually a property at all…which I did not really think through…but now that I know…I can work with that.

Thanks for pointing that out…very helpful.

Mike