I’m likely to botch this question so be patient-ish.
I’m using a secondary binder (parented to a “master” binder)…which is working simply great. But now I have a weird situation. In the second binder, I have a need to take an existing scopes.request object created in the first binder and extend it so that to the second binder, it “looks” like the same object but now has additional methods associated with it (attempting through mixins) relevant to the nature of the child binder.
This of it this way…(not using coldbox for this project, but pretend with me). In a module, I want to grab a user object from the main application and within that module, extend the user object to provide easy syntax to other methdologies that only the modules cares about. I could easily write a service object and pass it the main applications variable, yada yada…I mean really there are several ways I suppose this could “easily” be handled…but this is what I would like to do:
Imagine in my main application binder I have delcared:
map(“CurrentUser”).to(“models.users.User”).into(this.scopes.request);
later the module is loaded and ULTIMATELY (say it’s a module for managing a persons list of pysicians)…somewhere in the interfaces in the modules, You might stumble across:
arrayofdocs = CurrentPatient.GetListOfPhysicians();
CurrentPatient IS CurrentUser ++ so in the module mappings for wb, I have tried things like:
map(“CurrentPatient”).toDSL(“CurrentUser”).mixins(“doctors.cfm”)
this does not break anything…CurrentPatient is equal to the CurrentUser as far as I can tell, but none of the mixins are in the object…so likely they are not actually equal…just not sure.
map(“CurrentPatient”).toValue(CurrentUser).mixins(“doctors.cfm”)
and that was just an epic fail so is likely not even the right track. Another though was to create my own “CurrentPaitent” object of the same type and just do some “cloning” methodology to get the property payload over…but that kinds feels dirty.
Does anyone have any helpful thoughts on whether there is a way to do what I’m suggesting here or should I just abandon hope and follow a more obivous path?
Thanks for any insight.
Mike