Re: Structures_DataGrid, automatic DB_DataObject joinAdd experiment
| From: | arnaud sellenet | Date: | Sat, 06 Jan 2007 07:59:33 +0000 |
| Subject: | Re: Structures_DataGrid, automatic DB_DataObject joinAdd experiment | ||
| References: | 1 2 3 4 5 6 7 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-26268@lists.php.net to get a copy of this message | ||
Sorry, I need to do more work on this, which seems to be potentially ok :
[category] id = category:parent_id parent_id = category:id 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