-
Notifications
You must be signed in to change notification settings - Fork 1
Operations with Queries
Gilberto Junior edited this page Dec 4, 2019
·
4 revisions
It's possible to make a query and execute the commands above.
public function updateAll(array $data): intThis method returns the number of rows affected.
PHP's way:
$repository
->isBetween('price', 0.99, 1.99)
->updateAll([
'category_id' => 22,
]);SQL's representation:
UPDATE products SET category_id = 22 WHERE price BETWEEN 0.99 AND 1.99;public function deleteAll(): intThis method returns the number of rows affected.
$repository
->equals('active', 0)
->deleteAll();SQL's representation:
DELETE FROM users WHERE active = 0;by c0dehappy