Eduard Luca
Eduard Luca

Reputation: 6611

Bulk insert into DB with Zend

I've seen on SO that you can do multiple inserts without having to do them in a loop, with the createRowset and createRow methods.

My problem is, that I'm not sure in which class the createRowset method is defined. I have the following code, which fails with an 500 internal error:

$twitterUsersModel = new TwitterUsers($this->db_adapter);
$rowset = $twitterUsersModel->createRowset(); // this is the line that fails
foreach ($data as $d) 
{
    $row = $twitterUsersModel->createRow($d);
    $rowset->addRow($row);
}
$rowset->save();

My TwitterUsers class extends the Zend_Db_Table_Abstract class, which (as far as I can tell) doesn't have a createRowset method (just tested with extending Zend_Db_Table, still not working). Is there any other way to do this from a Zend_Db_Table_Abstract extending class?

Upvotes: 3

Views: 2896

Answers (1)

Raj
Raj

Reputation: 22926

Its defined nowhere actually. This feature is not yet implemented in Zend framework. However this is proposed as a new feature in Zend Framework Issue tracker.

http://framework.zend.com/issues/browse/ZF-2322

Vote for it, to get the feature sooner.

Upvotes: 5

Related Questions