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

Is it a bug?

model:

public class SomeModel
{
    public $id; //Not nullable
    public $fieldA; //Not nullable
    public $fieldB; //Not nullable
    .
    .
    .

controller:

public class SomeController
{
    public function SomeAction()
    {
        $someModel = SomeModel::findFirst(...);
        $someModel->fieldB = 123;
        $someModel->update();
        //if the original value of fieldA in db is empty string, it will raise an error here
        //fieldA is required
        .
        .
        .


16.4k

what version are you using?

Try using

public class SomeController
 {
     public function SomeAction()
     {
         $someModel = SomeModel::findFirst(...);
         $someModel->fieldB = 123;
         $someModel->save();

Instead of update



16.4k

Update to phalcon 2.0.4 , 2.0.3 had a issue with update when the record exsitis thats why its not updating , like casey said in 2.0.3 you had to use save instaed of update



29.1k

Both version 2.0.3, 2.0.4 and 2.0.5 have this issue.



4.7k

Did you try Dynamic Update?

That should only update the fields that you changed.