Re: DataObject::toArray

From: Date: Tue, 27 May 2003 16:14:10 +0000
Subject: Re: DataObject::toArray
References: 1  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-5629@lists.php.net to get a copy of this message
toArray currenly will only return the objects table names, to make this work, it would have to flag up that there are variables that where returned that where outside the table definition. would involve: adding a flag to fetch - if it finds a var not in the table set.. - $this->_hasExtraVars = true; then in the toArray, if that flag is set, use the object vars, rather than the table def. to generate the toArray set. Regards Alan Limbourg Arnaud wrote:
Let me guess... toArray() returns an array ?
Yes, but it returns an array from the object. Only it seems to do so on predefined variables of the object, not when they are added dynamically. From the doc: SELECTADD <?php $person = new DataObjects_Person; $person->selectAdd(); $person->selectAdd('id,name'); while ($person->fetch()) { echo "$person->id} {$person->name}<BR>"; } $person = new DataObjects_Person; $person->selectAdd("DATE_FORMAT(birthday,'%d %m %Y') as birthday_formated "); $person->id = 12; $person->find(TRUE); echo "$person->name} {$person->birthday_formated}<BR>"; ?> TOARRAY ->toArray() -- Get an array of the current result Only the current result does not seem to include statement from the selectAdd. Arnaud.


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