Class Phalcon\Mvc\Model\Query\Status

implements Phalcon\Mvc\Model\Query\StatusInterface

Source on GitHub

This class represents the status returned by a PHQL statement like INSERT, UPDATE or DELETE. It offers context information and the related messages produced by the model which finally executes the operations when it fails

  1. <?php
  2. $phql = "UPDATE Robots SET name = :name:, type = :type:, year = :year: WHERE id = :id:";
  3. $status = $app->modelsManager->executeQuery(
  4. $phql,
  5. [
  6. "id" => 100,
  7. "name" => "Astroy Boy",
  8. "type" => "mechanical",
  9. "year" => 1959,
  10. ]
  11. );
  12. // Check if the update was successful
  13. if ($status->success() === true) {
  14. echo "OK";
  15. }

Methods

public __construct (mixed $success, [Phalcon\Mvc\ModelInterface $model])

public getModel ()

Returns the model that executed the action

public getMessages ()

Returns the messages produced because of a failed operation

public success ()

Allows to check if the executed operation was successful