Loading ...
Sorry, an error occurred while loading the content.

Re: [fusebox5] No-XML MVC Question

Expand Messages
  • John M Bliss
    You lost me. Won t it go like this...? 1. onreqest 2. controller 3. model - where Object is initially defined 4. controller 5. view - where Object is
    Message 1 of 9 , Nov 1, 2008
    • 0 Attachment
      You lost me.  Won't it go like this...?
      1. onreqest
      2. controller
      3. model - where "Object" is initially defined
      4. controller
      5. view - where "Object" is consumed
      6. onreqestend
      How will structAppend(variables, event.getAllValues(), true) in onreqest/onreqestend help get my Object into the view's variables scope?  During onreqest, Object is not defined and, during onreqestend, it's no longer needed.

      On Fri, Oct 31, 2008 at 6:52 PM, Adam Haskell <a.haskell@...> wrote:

      I was doing this in onreqest or onreqestend

      Adam

      Sent from my iPhone

      On Oct 31, 2008, at 10:07 AM, John M Bliss <bliss.john@...> wrote:

      > structAppend(variables, event.getAllValues(), true)

      One can do this in the controller and then "see" variables.Object in the view?  In this thread:

      http://tech.groups.yahoo.com/group/fusebox5/message/3743

      ...I concluded that "variables" scope is not shared between controller & view and Sean Corfield seemed to confirm this and suggested FB event.

      Let me know...

      On Fri, Oct 31, 2008 at 8:49 AM, Adam Haskell <a.haskell@...> wrote:


      On Friday, October 31, 2008, at 06:05AM, "John M Bliss" <bliss.john@...> wrote:
      >I was mostly complaining about:
      >
      ><cfset Object = event.getValue("Object")>
      >
      >That strikes me as code that should be kept out of the view.

      I think that is your previous Fusebox experiences talking ;) event object is there to expose data to your view. It doens;t always have to be simple data a struct isn't much different nor would it be passing out a Transfer Object. Hell in all honestly you could pass an object from even lower down if you wanted. Heresy? As long as the designer is not using the logic bits and only grabbing data all is good and later on if you need to refactor you can (in your service or controller) and make a TO available.

      >Seth's suggestions:
      >
      >#attributes.Object.field# or #event.getValue(object.field)#

      Not sure I like the attributes.Object.field. The second one is essentially the same as the original, only more typing (not that this should matter if for whatever reason you feel more comfortable with this method.

      >are an improvement. Thoughts...?

      An additional thing I have done (and this was to maintain compatibility mostly for legacy apps) was I pull stuff off the event stack and push it straight into the variables scope prior to calling my layouts, structAppend(variables, event.getAllValues(), true).Not sure if I like it since I have not actually implemented it yet but it seems to be a, mostly, elegant solution right now.

      Adam




      --
      John Bliss
      IT Professional
      LinkedIn: http://www.linkedin.com/in/jbliss




      --
      John Bliss
      IT Professional
      LinkedIn: http://www.linkedin.com/in/jbliss
    Your message has been successfully submitted and would be delivered to recipients shortly.