Virtual Inheritance
You can make two CFCs blend together simulating a virtual runtime inheritance with WireBox. WireBox will grab the target CFC and blend into it all of the virtual inheritance CFC's methods and properties. It will then also create a $super reference in the target and a $superinit() reference. This is a great alternative to real inheritance and allow for runtime mixins to occur. You start off by mapping the base or source CFC and then mapping the target CFC and declaring a virtualInheritance to the base or source CFC:
1
// Declare base CFC
2
map("BaseModel").to("model.base.BaseModel");
3
4
map("UserService").to("model.users.UserService").virtualInheritance("BaseModel");
Copied!
This will grab all methods and properties in the BaseModel CFC and mix them into the UserService, then create a virtual $super scope which will map to an instantiated instance of the BaseModel object.
Last modified 4mo ago
Copy link