[coldbox-3.5 RC1] provider, inject transient into transient

in upgrading fro CB 3.1 to CB 3.5 RC1 I have run into an issue. I have
a User bean that is composed of multiple address, contact, etc. beans
that gets created onSessionStart.

Back in 2010, on advice from Luis, I had created a ColdboxProvider.cfc
that extended "coldbox.system.remote.ColdBoxProxy" with just the get()
function that returned getController() and then used that in my
onDIComplete function in my User bean to set up the other composed
transients.

This worked fine, but no longer functions in 3.5. I assume this is
because providers are now part of CB core/wirebox?

I have been trying to wrap my head around how to properly use WB/
providers to do this now and just cannot seem to get it working
properly.

Could someone help me out with the proper syntax and best practice
method for creating a transient bean composed of multiple transient
beans in onSessionStart and placed into the SESSION scope in CB 3.5?

Thanks,
Andy

So I am definitely experiencing this scope widening issue again on reinits where - for instance - the User bean created onSessionStart requires certain info set in the settings of Coldbox.cfc, etc. I have many other settings that get run and cached in an afterAspectsLoad interceptor which helps… but I cannot seem to get the old “hacked” provider to work and cannot seem to grok the new 3.5 docs on how to go about it in the 3.5 BE release?

Thanks for any help someone can provide?
Andy

I will ask, why are you storing this much information in the session scope?

I am storing:

– UserBean: created onSessionStart that holds some basic user-agent info, time created, etc. and is composed of following beans loaded onDIComplete:
----- shopping cart
----- billing info
----- shipping info
----- contact info

Would you advise otherwise? Even if you would, I think that there still needs to be a way to handle the scope widening issue and my (limited) understanding is that this is where provider methods come in handy?

Thanks for any help/advice on this!

When dealing with session, you want to keep a minimum amount of information in there as possible. If you need these then you can DI these into your model / service and use them from there.

I can see what you are trying to do, but I am a strong believer that if you need it then call it. Database calls are cheap, if you want to make it stay around make it a singleton.

Session variables stay around by default for 2 hours, that means if you have 256 bytes of information stored in the session scope, and you have a million users hit your site, the memory spike would be huge.

Now you may not expect that sort of traffic to begin with, but lets look at maintenance! Would you prefer to code it right now, or try to find why the servers are falling over in 5 years time?

And can you clarify what you mean by scope widening?

Sorry Andrew, I guess this is not specifically a scope widening issue (which I understand to be the potential wonky, unintended result caused from injecting something that is time-based into an obj which could expire prior to its parent object?) I understood that a “provider” helped prevent this issue and Luis helped me to fix my current issue here:

https://groups.google.com/d/topic/coldbox/2-ZgR1VILwU/discussion

So I referenced “scope widening” in THIS thread as it was alluded to in his response in that previous discussion of the same situation. Sorry if that confused anyone!

In any event, it was a combination of using the afterAspectsLoad interceptor and the ColdBoxProvider.cfc get() function mentioned previously that got this to work ok. Basically this works just fine in CB 3.1 but not in CB 3.5-BE.

Understanding that CB’s provider methods are now there to handle these types of situations, I thought that that’s where I ought to be looking?

While I take your points on the best way to do things, I do have this inherited app that currently does things this way and so I am trying to slowly move it along. Perhaps I will change the entire SESSION based user/cart paradigm in the future, but for right now I am just trying to get CB 3.5-BE to work…

Again, thank you so much for taking the time to reply and offer your advice!
Andy

No problems, that why I asked and provided. And yeah, scope widening is what your seeking there, but I am confused is this something you built into ColdBox or is the shopping Cart a 3rd party application. Reason I ask is that with some small modification, you could still use the session but maybe from a different angle.

Might have to see what Luis says, but you talk about extending the ColdBox proxy. Are you using that for requests from Flex / Flash?

And when you say it is not working, what specifically is not working. Does it error, is something firing in the wrong order. Can you explain a little more what you mean there.