[turba] Map attribute in the sources
Christian Couder
christian@alcove.fr
Wed, 03 Jan 2001 10:18:55 +0100
Chuck Hagenbuch wrote:
>
> Quoting Christian Couder <christian@alcove.fr>:
>
> > I think there will be problem with this terminology if someone want to
> > add another kind of object.
>
> I think what I originally envisioned was that you'd add a different Source for
> different kinds of objects. I mean, you're going to be searching different
> kinds of objects differently; it's also likely that it'd make sense to put them
> in seperate database tables.
Yes, but the database will probably be the same, so if you have many
tables in the same database it means creating a datasource for each
table.
I don't think it is the right thing to do.
> What you suggest might work, but it also makes the
> config files _really_ complicated.
Yes, they will be more complicated, but I think anyway that the files
containing the config data should be created by the app.
I mean there could be some default files that contains example data, but
the user should be able to easily create new config files for his own
databases (or ldap directories) with the app.
So if we can do this, the user won't see the config file complexity.
> > It adds a few more levels but I think it's the right thing to do.
>
> It's still possible that you're right, but I think we should keep the config
> file simple if possible. Thoughts?
Perhaps this one is better:
'map' => array(
'user' => array(
'params' => array(
'table' => 'addresses',
'turba_class' => 'Turba_Object'
),
'attributes' => array(
'__key' => 'uid',
'name' => 'fullname',
'email' => 'email',
'alias' => 'alias'
),
),
'project' => array(
'params' => array(
'table' => 'projects',
'turba_class' => 'Turba_Object'
),
'attributes' => array(
'__key' => 'pid',
'title' => 'title',
'desc' => 'description',
'start' => 'start_date'
)
),
'address_list' => array(
'params' => array(
'table' => 'contacts',
'turba_class' => 'Turba_Group'
),
'attributes' => array(
'__key' => 'group_id',
'owner' => 'owner_id',
'name' => 'name'
)
)
)
There is one less level, and the class used in turba is coded directly
in the 'params' instead of using 'object' or 'group'.
I wish a good new year to all of you on the Turba list.
--
Christian COUDER christian@alcove.com
Open Source Software Engineer
Alcove - http://www.alcove.com/