Re: Structures_DataGrid, automatic DB_DataObject joinAdd experiment
| From: | Justin Patrin | 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:idOny 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 *,-- Justin Patrintable0.idasparent_id__id,table0.nameasparent_id__name,table0.parent_idasparent_id__parent_idFROMcategoryLEFT JOINcategoryAStable0ONtable0.id=category.parent_id