Re: DataObject & Formbuilder self ref. tables
| From: | Markus Wolff | Date: | Thu, 29 Apr 2004 13:24:51 +0000 |
| Subject: | Re: DataObject & Formbuilder self ref. tables | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-12223@lists.php.net to get a copy of this message | ||
Mike Carter wrote:
[shopcategory] shopcategory_id = shopcategory:id shopimage_id = shopimage:id So a category can be nested within a parent category. My problem is the auto-generated form - the 'shopcategory_id' field doesn't get auto-generated as a select list containing all the existing categories in the table.Hi Mike, is the field shopcategory_id displayed at all? If not, you might have an issue with the key order for this table - the key that's listed in the [shopcategory__keys] section of your main .ini file is treated as the primary key and will be rendered as a hidden field. Other than that, I currently have no clue - self-referencing relationships work like a charm for me - although: when you use them for making a tree structure, you'll really *want* to write the code yourself that fills the selectbox for the parent_id. Because if you don't, all ID's will be listed as possible parents, even those that are lower in the hierarchy than the node you're currently editing. If you choose such a lower node as your parent, your tree structure becomes corrupt and the tree can't be displayed anymore. CU Markus