SAS1024
Active member
I tried to update huge count of posts in transaction:
But I've got an error:
What going wrong? Where is my mistake? Please, help me to resolve this issue.
PHP:
$finder = \XF::finder( 'XF:Post' );
$db = \XF::db();
/** @var Post[] $posts */
$posts = $finder
->where( 'message_state', '=', 'visible' )
->fetch();
// $posts contains over 1000 elements...
$db->beginTransaction();
foreach ( $posts as $post ) {
$post->message = 'some updated message';
$post->save();
}
$db->commit();
Code:
In Entity.php line 215:
Unknown column
What going wrong? Where is my mistake? Please, help me to resolve this issue.
Last edited: