Re: Structures_DataGrid, automatic DB_DataObject joinAdd experiment

From: Date: Sat, 06 Jan 2007 11:04:14 +0000
Subject: Re: Structures_DataGrid, automatic DB_DataObject joinAdd experiment
References: 1 2 3 4 5 6 7 8  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-26269@lists.php.net to get a copy of this message
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.
I just need to refine my selectAdd() now because : <?php $cat = & DB_DataObject::factory('category'); $parentcat = & DB_DataObject::factory('category'); $cat->joinAdd($parentcat,'LEFT','table0'); $cat->selectAs($parentcat,'parent_id__%s','table0'); $cat->find(); ?> makes sense : SELECT *, table0.id as parent_id__id , table0.name as parent_id__name , table0.parent_id as parent_id__parent_id FROM category LEFT JOIN category AS table0 ON table0.id=category.parent_id
-- Justin Patrin

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