So, Wirebox has the concept of Virtual Inheritance...
# fw1
m
So, Wirebox has the concept of Virtual Inheritance (https://wirebox.ortusbooks.com/advanced-topics/virtual-inheritance), where you can effective blend two cfc's together - wondering if anyone has tried anything similar in an FW/1 app?
c
I'm curious what the advantage of virtual inheritance is over real inheritance (using
extends=
in the component declaration)?
đź‘Ť 1
m
in this instance it's in order to use some ColdBox functionality in a FW/1 app. The ColdBox scheduler functionality is pretty awesome on its own, but you can do a bit more by configuring it, which in this case seems to be done via virtual inheritance.
I haven't thought to much about how else it would be used
d
Can't say I have seen anyone do something similar but also can't say I see a ton of use. I think a lot of the non reusability (in the case of not being able to use them outside of the box) that comes from modules and Ortus things is their use of not having clearly defined object contracts and these “magic” function handling and injection
m
fwiw, I learned that I can loop over the methods in a component and assign them to another component, which solves my issue in this case, though as you all have noted, I'm not sure of any wider use-case:
Copy code
for( var m in getMetadata(configCFC).functions){
      targetCFC[m.name] = configCFC[m.name];
    }