We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to perform batch modification operations without querying and iterate through modifications
According to the document:
An UPDATE statement performs the update in two phases:
UPDATE
WHERE
This way of operation allows events, virtual foreign keys, and validations to be executed during the updating process. In short, the code:
<?php $phql = " UPDATE Invoices SET inv_status_flag = 0, inv_total = 0 WHERE inv_cst_id > 10"; $result = $this ->modelsManager ->executeQuery($phql) ; if (false === $result->success()) { $messages = $result->getMessages(); foreach ($messages as $message) { echo $message->getMessage(); } }
is somewhat equivalent to:
<?php use MyApp\Models\Invoices; $messages = []; $invoices = Invoices::find( [ 'conditions' => 'inc_cst_id = :customerId:', 'bind' => [ 'customerId' => 10, ], ] ); foreach ($invoices as $invoice) { $invoice->inv_status_flag = 0; $invoice->inv_total = 0; $result = $invoice->save(); if (false === $result) { $messages[] = $invoice->getMessages(); } }
For more details, you can refer to the Phalcon documentation.
The text was updated successfully, but these errors were encountered:
If you know the queries you're making and want to bypass those checks, then you can run a native query instead https://docs.phalcon.io/5.8/db-layer/#update
Sorry, something went wrong.
No branches or pull requests
How to perform batch modification operations without querying and iterate through modifications
According to the document:
An
UPDATE
statement performs the update in two phases:UPDATE
has aWHERE
clause, it retrieves all the objects that match these criteria.This way of operation allows events, virtual foreign keys, and validations to be executed during the updating process. In short, the code:
is somewhat equivalent to:
For more details, you can refer to the Phalcon documentation.
The text was updated successfully, but these errors were encountered: