Grzegorz Polska Sat Aug 06 14:32:42 -0400 2016

Subject: Update multiple rows

Hi,
I have a simple question:
Is there any chance to update multiple rows in Active Records by like that:

$images = Galleries::all([
    'conditions' => [
        'articles_id IS NULL AND users_id = ?',
        Kernel::$app->auth->user->id
    ]
])

$images->articles_id = $article->id;
$images->save();

or there is only method like that:

Galleries::update_all([
    'set' => [
        'articles_id' => $article->id
    ],
    'conditions' => [
        'articles_id IS NULL AND users_id = ?',
        Kernel::$app->auth->user->id
    ]
]);

Best cheers!