I am trying to update the name of a user id=1
. I tried the following code (v 1.3). But instead of updating, it t replaces the user and var_dump($n->getMessages());
outputs errors relating to not null
attributes.
class UserApi extends Phalcon\DI\Injectable{}
$n=new User;
$n->id=1;
$n->name='Tom';
$n->save(); //or even $n->update()
User::findFirst(1)->save();
works. But I prefer to use a single code for both create and update operations.