I figured as much. Though I get the feeling the variables in my application
scope won't be available?
> Jared,
>
> This is where something like DI/1 or ColdSpring can come in very handy,
>
> as you can use them to manage these dependencies for you. Otherwise
> you'll need code in your remote methods to handle them:
>
> // at the top of your remote method
> if (!StructKeyExists(VARIABLES, "oShopifyOrderBusiness) {
> // Create the Variable
> }
>
> Steve 'Cutter' Blades
> Adobe Community Professional
> Adobe Certified Expert
> Advanced Macromedia ColdFusion MX 7 Developer
> ____________
> http://cutterscrossing.com
>
>
> Co-Author "Learning Ext JS 3.2" Packt Publishing 2010
> https://www.packtpub.
com/learni>
ng-ext-js-3-2-for-building-dynamic-desktop-style-user-interfaces/book
>
> "The best way to predict the future is to help create it"
>
> On 1/22/2014 10:58 AM, Jared Evans wrote:
> > I would normally post this sort of thing up on StackOverflow, but
> i'm not sure it really fits there.
> >
> > So I've started messing around with (3rd party) webhooks and had a
> bright idea of using remote functions to intercept the hook. Sure
> enough i wrote my function and started firing browser requests at it
> and dumping whatever came at it.
> >
> > I was pretty pleased with myself.. then i tried getting serious.
> >
> >
> > we have a setup at work that looks kinda like this.
> >
> > C:\webroot\
> > C:\webroot\_objects\
> > C:\webroot\site1\
> > C:\webroot\site2\
> > etc
> >
> > Now "C:\webroot\_objects\" contains all of our objects we use along
> with Application.cfc. C:\webroot\site1\ are our various sites
> containing "application.cfc" [small "a"].
> >
> > application.cfc tells Application.cfc which objects the sites use,
> and Application.cfc goes about loading them via .cfm files.
> >
> > doing things like:
> >
> > local.stArgs = {};
> > local.stArgs.sDSN = application.stSiteVars.stDSN.sShop;
> > local.stArgs.oCFML = application.stObj.oCFML;
> > local.stArgs.oFormat = application.oFormat;
> > local.stArgs.sJournalCode = application.sSiteCode;
> > local.stArgs.oShopDAO = application.stObj.oShopDAO;
> > local.oShopifyOrderBusiness = createObject("component","_objects.
> _core._shopify.shopifyOrderBusiness").init(argumentCollection=local.
> stArgs);
> >
> > application.stObj.stShopify.oShopifyOrderBusiness = local.
> oShopifyOrderBusiness;
> >
> > local.stArgs.oShopifyOrderBusiness = application.stObj.stShopify.
> oShopifyOrderBusiness;
> >
> > local.oShopifyWebHookBusiness = createObject("component","_objects.
> _core._shopify.shopifyWebhookBusiness").init(argumentCollection=local.
> stArgs);
> >
> > application.stObj.stShopify.oShopifyWebHookBusiness = local.
> oShopifyWebHookBusiness;
> >
> > As you can see, "oShopifyWebHookBusiness" takes
> "oShopifyOrderBusiness" as an argument, and within the init function
> of "oShopifyWebHookBusiness" it places oShopifyOrderBusiness into the
> variables scope ("variables.oShopifyOrderBusiness = arguments.
> oShopifyOrderBusiness").
> >
> > I guess you can see where this is leading (well if my reading is
> correct, if not you're probably lost).... When you call a remote
> function, it instantiates the object each time, meaning the init never
> gets called and the variables scope does not contain a reference to
> "oShopifyOrderBusiness", meaning I can't easily pass off anything from
> the remote function to another function within "oShopifyOrderBusiness".
>
> >
> > To get around this, i've had to fall back to passing webhooks to a
> cfm, which then allows me to do what i originally wanted to do, due to
> it already being instantiated with the various items in the variables
> scope.
> >
> > Has our setup screwed us, or have i read the situation wrong and I'm
> missing something.
> >
> >
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive:
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:357494
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm