Re: DB_DO_FormBuilder and custom getters
| From: | Justin Patrin | Date: | Fri, 14 Oct 2005 23:38:00 +0000 |
| Subject: | Re: DB_DO_FormBuilder and custom getters | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-21486@lists.php.net to get a copy of this message | ||
On 10/14/05, arnaud sellenet bodin <demental@free.fr> wrote:
> Hello everybody !
>
> I have a database structure like this :
> ____________ ________________
> | contacts | | contact_types |
> +------------------+ +--------------------------+
> | id PK | | id PK |
> | email | | name |
> | idType FK | | fatherId |
> +------------------+ +--------------------------+
>
> the contact_types has a tree structure
>
> (I did not use PEAR_Tree, but) made a custom getter so that :
>
> $ct= & DB_DataObject::factory("contact_types");
> $ct->get(13);
> echo $ct->getName();
>
> echoes the path from the root to the element (e.g. root>elt1>elt1.1)
>
> If I bind the DBDO instance to a Structures_dataGrid, it gets the name
> from getName() instead of reading directly the Name property from the
> object, which I expected.
>
> So my question is : is there a way to configure formbuilder so that it
> behaves like DG ? (as apparently it does not by default). For the
> moment I juste made a select in the fb_preDefElement but I don't like
> this solution.
The short answer is no. FormBuilder does not currently support getters
and it only supports setters on some fields. It could be *possible* to
implement such a thing, but it's going to be a major undertaking.
DB_DO is very tightly integrated into FB and it directly accesses the
fields all over the place.
--
Justin Patrin