<div dir="ltr"><div><div>I don't know if this is the proper list, but I assume most Magritte users use it for Seaside :)</div><div><br></div><div>Let's suppose I'm building a Seaside component by sending #asComponent to my domain model, that has one description like this:<br>
</div><div><br></div><div>descriptionStore</div><div><span class="" style="white-space:pre">        </span><magritteDescription></div><div><br></div><div><span class="" style="white-space:pre">        </span>^MASingleOptionDescription new</div>
<div><span class="" style="white-space:pre">                </span>label: 'Store';</div><div><span class="" style="white-space:pre">                </span>accessor: #store;</div><div><span class="" style="white-space:pre">                </span>beRequired;</div>
<div><span class="" style="white-space:pre">                </span>options: Store readAll; "I want to replace this"</div><div><span class="" style="white-space:pre">                </span>yourself</div></div><div><br></div><div><br></div>
<div>
I want to replace the access to the global (Store in this case) by a collection I "inject" somehow, coming from the Seaside session in this case.<br></div><div><br></div><div>In my component I can evaluate something like "self session allStores", and that's what I'd like to inject into the creation of the description.</div>
<div><br></div><div>Is there some kind of pattern to solve this? Which also introduces some coupling with a global (Store), difficulting its testing.<br></div><div><br></div><div><br></div><div>In the top of my mind I'm thinking of something like the following:<br>
</div><div><br></div><div>"in the context of a WAComponent"</div><div>self call: (myModel asComponent: self session)</div><div><br></div><div>And then inject the session to something like:</div><div>descriptionStore: aSession<br>
</div><div><div><span class="" style="white-space:pre">        </span><magritteDescription></div><div><br></div><div><span class="" style="white-space:pre">        </span>^MASingleOptionDescription new</div><div><span class="" style="white-space:pre">                </span>label: 'Store';</div>
<div><span class="" style="white-space:pre">                </span>accessor: #store;</div><div><span class="" style="white-space:pre">                </span>beRequired;</div><div><span class="" style="white-space:pre">                </span>options: aSession allStores;</div>
<div><span class="" style="white-space:pre">                </span>yourself</div></div><div><br></div><div>Best regards,</div><div><br></div><div>Esteban A. Maringolo</div>
</div>