I've got a quick question that I didn't really find an answer to in the
documentation: What is the best way to share resources across a group of
components?
Let's say I have three components: component_Foo, component_Foo_Bar, and
component_Foo_Rab, corresponding to the mappings '/foo', '/foo/bar', and
'/foo/rab'.
Now component_Foo_Bar and component_Foo_Rab will both need to use
certain common resources (such as an instance of an ORM class and a
couple of other things). Having each component instantiate/create/load
these resources is going to be pretty slow and wasteful, so I'd like to
have component_Foo load them once at dispatch time so that they're
accessible to every other component beneath it.
The problem is that, as far as I can tell, there's not really a good way
to go about that. I can't make the components subclasses of
component_Foo, since then things like parent::dispatch() won't work as
expected. I don't want to subclass the k_Document class since a) I
already do that for other parts of my app and b) the documentation seems
to caution against using it as a "dumping ground" for global variables.
Therefore, I'm a bit at a loss as to the best way to do this. Any
advice would be appreciated.
Thanks,
Rob