Re: DB_DataObject_FormBuilder : $fb_linkDisplayFields in inherited classes

From: Date: Wed, 20 Apr 2005 14:48:20 +0000
Subject: Re: DB_DataObject_FormBuilder : $fb_linkDisplayFields in inherited classes
References: 1  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-18830@lists.php.net to get a copy of this message
I think I've found a solution : In my DOCUMENTS DO class, I use the prepareLinkedDataObject callback function. The value displayed for the checkboxes is ID, and I want to see NAME. So, I set the 'data_select' value in the linkedDataObject to "NAME as ID", so, the NAME will be selected for linkedObject, and aliased as ID, and the NAME will be auto-magically displayed. An example : function prepareLinkedDataObject(&$linkedDataObject, $field) { switch ($linkedDataObject->__table) { // for m:n between DOCUMENTS and LANGUAGES case "LANGUAGES" : $linkedDataObject->_query['data_select'] = "NAME as ID" ; break; // for m:n between DOCUMENTS and CATEGORY case "CATEGORY" : $linkedDataObject->_query['data_select'] = "NAME as ID" ; break; } } Thomas Balthazar. On 19 Apr 2005, at 16:42, Thomas Balthazar wrote:
Hello, The situation : - the main table DOCUMENTS - the secondary tables : LANGUAGES and CATEGORY There is a m:n relation between : - DOCUMENTS and LANGUAGES and between - DOCUMENTS and CATEGORY In the DOCUMENTS form, I can easily display checkboxes for the LANGUAGES and CATEGORY values (with "$fb_crossLinks"). The values displayed for the checkboxes are LANGUAGES and CATEGORY IDs. I would like to display the associated values. I know that I can do that by setting the "var $fb_linkDisplayFields = array('name');" in the auto-generated LANGUAGES and CATEGORY DataObject classes. My problem is that I don't want to modify those classes because they are auto-generated. If I alter the DB, then regenerate the DO, my modifications will be lost... So, I always work in classes that inherit from those auto-generated classes. But how can I do to specify "var $fb_linkDisplayFields = array('name');" in those inherited classes in place of the auto-generated ones. Thanks in advance for your help. Thomas Balthazar. -- PEAR General Mailing List (http://pear.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php


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