[TYPO3-core] RFC: #11438: Add a registry to t3lib

Ernesto Baschny [cron IT] ernst at cron-it.de
Mon Aug 10 18:19:16 CEST 2009


Ingo Renner schrieb:
> To all those in favor of a separate namespace argument,
> 
> 
> Did any of you try to work with what you propose?
> Did any of you have a look at the usage as in the unit tests for example?
> Aren't  programmers lazy people?
> What value does it really add?
> Why are you insisting on that (to me superfluous) argument so much?
> Did you have a look at other projects that implement a registry (or the
> original variable_*() functions from Drupal)?
> 
> 
> To me it feels like a nice feature is drowning in discussions again. The
> - still to come - reports module will make use of the registry, it'll
> also make use of a patch that adds flash messages for the BE (#11684 for
> those interested). But as I see such a tiny, simple feature being
> "disimproved" that way, I doubt whether I should hand in the rest of the
> stuff.

You are the one that added the "namespace" concept, in a way which I
find ugly (as a prefix to the key). So either we remove it completely or
consider the idea of additional parameter.

Against removing it speaks my experience with the cache_hash table,
where noone knows from where the keys come from, as the "ident" field is
not really used consistently. Having that information in hand allows us to:

- delete, backup and work with registry keys coming from a specific
extension only.
- avoid name clashes with different extensions working with the same
registry key names
- maybe speed up loading of registry keys (lazy loading for a specific
extension), which we could implemented later.

Against namespaces speaks only:

- programmers are lazy, they won't understand the namespaces anyway

So you might think we are all insisting upon something stupid, but it
might as well be that we see it just the other way around.

Don't get us wrong, the implementation is already nice and I am pleased
that you added the namespacing concept, but I just feel that it has to
be done "right" from start.

An example of something like this registry is in Gallery2-project
(http://gallery.menalto.com), where plugins can store "parameters" in
some kind of registry. It uses the plugin-name as a "namespace":

     * @param string $pluginType
     * @param string $pluginId
     * @param string $parameterName
     * @param string $itemId (optional)
     * @return array object GalleryStatus a status code
     *               string a value
     */
    function getPluginParameter($pluginType, $pluginId, $parameterName,
$itemId=0) {

It works pretty well and also implements the "lazy loading" by loading
all parameters for one plugin upon first hit and using that in memory
registry for later fetches for the same plugin.

Cheers,
Ernesto


More information about the TYPO3-team-core mailing list