Re: DataObject update
| From: | Esad Hajdarevic | Date: | Thu, 17 Mar 2005 18:12:30 +0000 |
| Subject: | Re: DataObject update | ||
| References: | 1 2 3 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-36724@lists.php.net to get a copy of this message | ||
Justin Patrin wrote:
Just expaning on the "edge case" idea. This *is* an edge case. If you have two DataObjects which represent the same record you're probably not using DB_DataObject correctly. It makes much more sense to use two copied of the same DO. $do =& DB_DataObject::factory('table'); $do->get(5); ... $do2 =& $do; $do2->col = 'val';I think we misunderstood each other. I'm talking about something like: <code> $d=new DataObjects_Dealer; $fb=& DB_DataObject_FormBuilder::create($d); $form =& $fb->getForm(); if ($form->validate()) {
$form->process(array(&$fb,'processForm'), false);} //at this point form is validated an the dataobject is processed //now I have to show the list of all dealers $d->find(); while ($d->fetch()) { ... } </code> The $d->find() wont work because of the data object manipulation done by processForm. So instead of typing something like $d->rewind(); one has to create new data object? Esad