[turba] Map attribute in the sources
Christian Couder
christian@alcove.fr
Wed, 20 Dec 2000 17:42:39 +0100
Chuck Hagenbuch wrote:
>
> Quoting Christian Couder <christian@alcove.fr>:
>
> > I think we must change this if we want to be able to deal with many
> > objects from the same source.
> >
> > For example if we want to deal with a source with both users and lists
> > we could have something like:
>
> Change the terminology to "objects" and "groups", and I'm happy:
>
> > 'map' => array(
> > 'object' => array(
> > '__key' => 'uid',
> > 'name' => 'fullname',
> > 'email' => 'email',
> > 'alias' => 'alias'
> > ),
> > 'group' => array(
> > '__key' => 'group_id',
> > 'owner' => 'owner_id',
> > 'name' => 'name'
> > )
> > )
Hi all,
I think there will be problem with this terminology if someone want to
add another kind of object.
For example if someone want to add a "project" object, it is not
possible to do just add:
'object' => array(
'__key' => 'pid',
'title' => 'title',
'desc' => 'description',
'start' => 'start_date'
),
And there are more problems, because currently the table is described in
another part of the config, in ['params']['table']:
$cfgSources['localsql'] = array(
'title' => 'Local SQL',
'type' => 'sql',
'params' => array(
'phptype' => 'pgsql',
'hostspec' => 'localhost',
'username' => 'jon',
'password' => 'foo',
'database' => 'gaia',
'options' => '',
'tty' => '',
'port' => '5432',
'table' => 'addresses'
),
'map' => array(
'__key' => 'object_ID',
'name' => 'name',
'email' => 'email',
'alias' => 'company'
),
'public' => false,
'readonly' => false
);
So I suggest the following 'map' attribute:
'map' => array(
'object' => array(
'user' => array(
'params' => array(
'table' => 'addresses'
),
'attributes' => array(
'__key' => 'uid',
'name' => 'fullname',
'email' => 'email',
'alias' => 'alias'
),
),
'project' => array(
'params' => array(
'table' => 'projects',
),
'attributes' => array(
'__key' => 'pid',
'title' => 'title',
'desc' => 'description',
'start' => 'start_date'
)
)
),
'group' => array(
'address_list' => array(
'params' => array(
'table' => 'contacts'
),
'attributes' => array(
'__key' => 'group_id',
'owner' => 'owner_id',
'name' => 'name'
)
)
)
It adds a few more levels but I think it's the right thing to do.
Regards,
--
Christian COUDER christian@alcove.com
Open Source Software Engineer
Alcove - http://www.alcove.com/
>From chuck@horde.org Date: Tue, 2 Jan 2001 16:08:46 -0500
Return-Path: <chuck@horde.org>
Mailing-List: contact turba-help@lists.horde.org; run by ezmlm
Delivered-To: mailing list turba@lists.horde.org
Received: (qmail 14149 invoked from network); 2 Jan 2001 21:09:33 -0000
Received: from r93aag000369.sbo-smr.ma.cable.rcn.com (HELO marina.horde.org) (209.6.192.126)
by horde.org with SMTP; 2 Jan 2001 21:09:33 -0000
Received: by marina.horde.org (Postfix, from userid 33)
id 73FB139F5; Tue, 2 Jan 2001 16:08:46 -0500 (EST)
Received: from 206.243.191.252 ( [206.243.191.252])
as user chuck@marina by marina.horde.org with HTTP;
Tue, 2 Jan 2001 16:08:46 -0500
Message-ID: <978469726.3a52435e67c27@marina.horde.org>
Date: Tue, 2 Jan 2001 16:08:46 -0500
From: Chuck Hagenbuch <chuck@horde.org>
To: turba@lists.horde.org
References: <3A38F3AC.13F95D93@alcove.fr> <976956729.3a3b2d39a6e73@nirgal.your.mom> <3A40E17F.232C5AF9@alcove.fr>
In-Reply-To: <3A40E17F.232C5AF9@alcove.fr>
MIME-Version: 1.0
Content-Type: text/plain
Content-Transfer-Encoding: 8bit
User-Agent: Internet Messaging Program (IMP) 2.3.6-cvs
Subject: Re: [turba] Map attribute in the sources
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. What you suggest might work, but it also makes the
config files _really_ complicated.
> 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?
-chuck
--
Charles Hagenbuch, <chuck@horde.org>
"If you can't stand the heat, get out of the chicken!" - Baby Blues