We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

can directly modify model?

Whenever you modify the record, the first query. $ rebot = Rebots :: find (1); $ rebot-> status = 0; $ rebot-> save ();

Use the MODEL can directly modify it? Such as:

$ rebot = new Rebots (); $ rebot-> id = 1; $ rebot-> status = 0; $ rebot-> save ();



98.9k

Yes, save() is a smart method, it checks if the record exists to creating or updating the object. This checking is performed according to the current values in the object.

If you want to avoid unexpected updates, you can use 'create' instead of 'save':

$robot = new Robots();
$robot-> id = 1;
$robot-> status = 0;
$robot-> create();