Re: DB_DataObject: Updating Linked Tables Best Pactices
| From: | Alan Knowles | Date: | Tue, 06 Apr 2004 00:52:14 +0000 |
| Subject: | Re: DB_DataObject: Updating Linked Tables Best Pactices | ||
| References: | 1 | Groups: | php.pear.general php.pear.general |
| Request: | Send a blank email to pear-general+get-11639@lists.php.net to get a copy of this message | ||
I'd be tempted to overload the update() method in the child class, to do an if (isset($this->_person)) ..
$this->_person->update();
or, explicity have a method which updates the linked records.. (which may be clearer in the code..)
Regards
Alan
Jacob Singh wrote:
The docs don't mention it, but what if you want to update linked records? I can't seem to get it to work... This would be handy for joins that are basically sibling in nature, i.e. so if I have $person and $employee and I run: $employee->rank = 5; $employee->_person_id->name = "foo"; $employee->update(); This only updates the rank not the name. If you have a form with both fields on it, what are best practices for this? thanks, Jacob Jacob Singh Technical Director Calabashmusic.com --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.617 / Virus Database: 396 - Release Date: 3/9/2004