[Seaside] "Injecting" options into a Magritte description
Esteban A. Maringolo
emaringolo at gmail.com
Tue Oct 1 00:55:59 UTC 2013
I don't know if this is the proper list, but I assume most Magritte users
use it for Seaside :)
Let's suppose I'm building a Seaside component by sending #asComponent to
my domain model, that has one description like this:
descriptionStore
<magritteDescription>
^MASingleOptionDescription new
label: 'Store';
accessor: #store;
beRequired;
options: Store readAll; "I want to replace this"
yourself
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.
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.
Is there some kind of pattern to solve this? Which also introduces some
coupling with a global (Store), difficulting its testing.
In the top of my mind I'm thinking of something like the following:
"in the context of a WAComponent"
self call: (myModel asComponent: self session)
And then inject the session to something like:
descriptionStore: aSession
<magritteDescription>
^MASingleOptionDescription new
label: 'Store';
accessor: #store;
beRequired;
options: aSession allStores;
yourself
Best regards,
Esteban A. Maringolo
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/seaside/attachments/20130930/2a0732d3/attachment.htm
More information about the seaside
mailing list