Using Zend Framework, I\'ve created a Model to insert a record into a database. My question is, after $this->insert($data)
how can I switch the active table
I think you should have another Model_DbTable
, Model_DbTable_Bar
and call it either
internally:
class Model_DbTable_Foo ... {
public function addFooAndBar() {
...
$bar = new Model_DbTable_Bar();
$bar->insert($data2);
}
}
or externally:
class ModelX ... {
public function addFoos() {
$foo = new Model_DbTable_Foo();
$foo->insert($data);
$bar = new Model_DbTable_Bar();
$bar->insert($data2);
}
}