Re: DB_DataObject loading linked values
| From: | Justin Patrin | Date: | Thu, 19 Aug 2004 17:45:10 +0000 |
| Subject: | Re: DB_DataObject loading linked values | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-14187@lists.php.net to get a copy of this message | ||
On 19 Aug 2004 11:17:20 -0000, Daniel Kopp <until-june-04@daniu.de> wrote:
> Hi!
>
> I need to do a number of differnet queries in one (QF)Action.
> To do this I first define what I want (a specific query) and later read
> it (for all different queries the same way)
>
> Now I would like to be able to get all values (also the linked ones) to
> save them in an array (e. g. with toArray()) Unfortunately toArray only
> gives me back the values from the original table even the Object has
> all the other values as properties as well. Is there a good way to get
> all (previous defined - not all possible) elements?
>
> I could imagine to define an array of values that I have above and
> later use that array to get the properties from the DB-Object but this
> would require the use of "eval" (as I need to find out the name of the
> DB-Object properties)
> However I do not like that way ... I there a better way?
>
Why do you need all of the linked values? A Form perhaps? Have you
looked into DB_DataObject_FormBuilder?
That said, I'm sure you don't need eval(). Take this snip of code for example:
$var = 'someVarName';
$o = new Obj();
$o->someVarName = 'hello';
echo $o->$var;
This will echo "hello".
--
DB_DataObject_FormBuilder - The database at your fingertips
http://pear.php.net/package/DB_DataObject_FormBuilder
paperCrane --Justin Patrin--