DB_DataObject fetch methods
| From: | Alex Hayes | Date: | Wed, 10 Mar 2004 03:06:01 +0000 |
| Subject: | DB_DataObject fetch methods | ||
| Groups: | php.pear.dev | ||
| Request: | Send a blank email to pear-dev+get-26243@lists.php.net to get a copy of this message | ||
Ok.. perhaps I am missing the point (wouldnt be the first time ;) However,
is there a way, or has someone written an extension that will allow some to
do the following:
$DataObject = DB_DataObject::factory('EFoundation_user_access');
$person->hair = 'green';
$DataObject->selectAdd();
$DataObject->selectAdd('*');
$result = $DataObject->getAll();
In this basic example, the getAll method would behave in the way that it
does when you use the DB class.
I thought that before I write an extension to do this, I should first check
if anyone else has, or perhaps im not using DB_DataObject correctly?
To do what I have done above you would need to do the following... i
believe..
$person= DB_DataObject::factory('person');
$person->hair = 'green';
$person->selectAdd();
$person->selectAdd('id,name');
$person->find();
while($person->fetch()) {
$result[] = $person->toArray();
}
So, ive only been looking at this for about an hour, so please correct me if
im wrong.
cheers
alex