Re: Formbuilder and multiple links?
| From: | Justin Patrin | Date: | Mon, 20 Dec 2004 18:39:12 +0000 |
| Subject: | Re: Formbuilder and multiple links? | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-16347@lists.php.net to get a copy of this message | ||
On Mon, 20 Dec 2004 22:47:14 +0530, Jacob Singh <jacob@pajamadesign.com> wrote:
> Can one link to 2 different tables using DB_DataObject_Formbuilder?
>
> I have an account table which holds Credit Card info.
>
> it links to the user table on account.user_id = user.user_id and
> account.account_type_id = account_type.account_type_id.
>
> So I want the form to show the username (not the user_id) and the
> account_type_name (not the account_id). I can get it to show just the
> account_type_id and user_id (in select boxes), and I can get it to show
> just the username (by setting linkDisplayFields), but I can't seem to
> get it to link to both tables. the links are fine, I've tested them.
>
> My code:
>
> $fb->linkDisplayFields = array ("user_id" => "username");
>
> if I use:
>
> $fb->linkDisplayFields = array ("user_id" => "username",
> "account_type_id" => "account_type_name");
>
> the script tries to select username from account_type!
>
> Any ideas here?
The linkDisplayFields stuff should be in the DataObject classes. You
also don't need keys, just list the fields you want displayed. For
example, in the User DataObject:
class DataObject_User extends DB_DataObject {
//auto-gen stuff
var $fb_linkDisplayFields = array('username');
}
>
> Thanks,
> Jacob
>
--
Justin Patrin