Re: Structures_DataGrid, automatic DB_DataObject joinAdd experiment

From: Date: Sat, 06 Jan 2007 19:37:38 +0000
Subject: Re: Structures_DataGrid, automatic DB_DataObject joinAdd experiment
References: 1 2 3 4 5 6 7 8 9 10  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-26273@lists.php.net to get a copy of this message
On 1/6/07, arnaud sellenet <demental@free.fr> wrote:
Le 6 janv. 07 à 12:04, Justin Patrin a écrit : On 1/5/07, arnaud sellenet <demental@free.fr> wrote:
Sorry, I need to do more work on this, which seems to be potentially ok : [category] id = category:parent_id parent_id = category:id
Ony the second one. You don't want or need the first. The parent_id in table category links to the id field in the table category, not the other way around. Yes that sounds anti-logical to me as well and is nothing but a hack. But that's the only .links.ini config that doesn't raise an error nor make the wrong join in the example I've provided.
Then you're doing it wrong. The id field is a primary key. A primary key is the column that uniquely identifies each record. A primary key is not a foreign key (link). parent_id is a field which tells you which record is the parent of a current record. It is a foreign key (or link) to another record. Only foreign key fields are listed on the left in the links.ini. Your biggest problem is that you're giving too many parameters to joinAdd(). DB_DO can "auto-join" DOs for you. -- Justin Patrin

« previous php.pear.general (#26273) next »