[dev] DataTree patch - Last

Chuck Hagenbuch chuck at horde.org
Sat Apr 24 15:02:08 PDT 2004


Quoting Carlos Pedrinaci <cpedrinaci at yahoo.es>:

> I have done it that way basicly because I understood you were looking
> forward for getting rid of the serialized data stuff. I thought that was
> the moment for doing so, as I was playing around with datatree stuff.
> My idea was to couple all kinds of migration scripts with the patches so
> as to avoid those issues, but I must however admit that I haven't
> checked yet at every horde module thus I don't know all the issues I
> might have to deal with.

I understand the instinct, but I'm not *completely* convinced yet that
datatree_data should go away as an option, and I think we should avoid 
coupling
these two things - more migration/changes, perhaps, but not that much, and
easier to deal with/less buggy. And I don't think the final version of this
patch should require a migration script for anything except perhaps Thor
itself.

> This is definitely an inconvenient of the pathes I've sent.
> To solve that I was thinking about using the constants that defines each
> application's base (THOR_BASE, AGORA_BASE etc..).
> I'm still unclear about how to re-use them in a nice way... but I'd say
> that would be the solution for that.

Here's my suggestion, after some thought:

Store, in the attributes for the object, not a classname, but a 
pseudo-MIME name
for the kind of object - for example, 'thor/project', 'thor/profile', etc.

Modify getObject() and getObjectById() such that if $class is null, you 
look for
the 'objectType' attribute or some similar name (loading the attributes
*before* instantiating the object, instead of how it's done now, but that
shouldn't cause any problems). Then, parse out the application name from the
'thor/project' string and do $class = $registry->call($app . '/defineClass',
array($objectType));

defineClass() will be more or less identical to the defineBlock method 
that's in
some apps already, and will make sure the necessary classname is loaded and
return the name of the class to instantiate.

How's that sound?

-chuck

--
"Regard my poor demoralized mule!" - Juan Valdez


More information about the dev mailing list