tag:robotlegs.tenderapp.com,2009-10-18:/discussions/questions/45-where-to-get-a-reference-to-model-when-a-mediator-dispatches-an-eventRobotlegs: Discussion 2018-10-18T16:35:08Ztag:robotlegs.tenderapp.com,2009-10-18:Comment/9128662010-01-26T13:56:59Z2010-01-26T13:56:59ZWhere to get a reference to model when a mediator dispatches an event ?<div><p>You could make use of IDs - each stack VO would have an ID, and
that ID would be passed to the stack view when you create it.
Events dispatched by the stack's mediator would pass the ID as an
event payload. The StackClickedCommand would use this ID to find
the corresponding VO in the model.</p>
<p>Does that help?</p></div>Shaun Smithtag:robotlegs.tenderapp.com,2009-10-18:Comment/9128662010-01-26T14:05:04Z2010-01-26T14:05:05ZWhere to get a reference to model when a mediator dispatches an event ?<div><p>Hi Shaun ! Thanks a lot for you really fast answer once again,
thanks !!! I thought of this solution a while agoo too, but I just
was wondering if something I didn't think of allready was doing
this king of things in robotlegs. So that's perfect !<br>
I had another question on this project, but I'll post it in another
thread to make it clearer for the comunity, thanks a lot once again
for your really precious help !</p></div>combes.benjamintag:robotlegs.tenderapp.com,2009-10-18:Comment/9128662010-01-26T14:08:33Z2010-01-26T14:08:33ZWhere to get a reference to model when a mediator dispatches an event ?<div><p>My pleasure! The downside to this approach is that the view
component itself ends up knowing about the application (more
specifically it has to know about it's ID) - this is a side-effect
of automatic mediator registration. Another option is to create and
register the mediators manually - that way you can set the ID
directly on the mediator rather than on the view component.</p></div>Shaun Smithtag:robotlegs.tenderapp.com,2009-10-18:Comment/9128662010-01-26T14:12:40Z2010-01-26T14:12:40ZWhere to get a reference to model when a mediator dispatches an event ?<div><p>Yes, in fact was thinking of storing this ID directly in the
mediator itself, instead of using the view, as my views have to be
fully decouplated from the system, it seems the best way to me to
keep all independant, thanks again !</p></div>combes.benjamin