Ignacio Rojas Wed Sep 08 08:41:22 -0400 2010

Subject: Batch Update

I How can i batch update rows?

Is for herarchical data model with left and right nodes, when i insert a new node i have to update all left nodes and right nodes from the table...

Is it posible?


Kien La Mon Sep 13 20:11:39 -0400 2010

Batch updates are not supported yet. You can keep an eye on this ticket if you want to know when it is done http://github.com/kla/php-activerecord/issues#issue/24

In the meantime you'll just have to do your batch updates directly using http://www.phpactiverecord.org/docs/ActiveRecord/Model#methodquery

Ignacio Rojas Tue Sep 14 11:24:21 -0400 2010

Could you post an example?

Jacques Fuentes Tue Sep 14 19:37:25 -0400 2010

You want to use find_by_sql which means you need to do it all manually.

$sql = "INSERT into my_table (name) VALUES ('Dave')";
MyModel::find_by_sql($inserts);

In this example you're simply crafting the entire query yourself and sending it through your model's PDO connection.

Ignacio Rojas Tue Sep 14 20:18:38 -0400 2010

You guy are making a great, great job, keep working on the PHP-AR and pleeeeeeeeeeeease implement the batch update and delete and execute_by_sql, just those 3 features, and then there almost nothing else to add for everyday development... please, please, pleaaaaaaaaaaaaase.... I can't live knowing that those features arent there... I'm a big fan of youre work and every day i'm checking for new updates!

(1-4/4)