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

Model annotations not nullable not working?

I have this annotation setup:

/**
 * @Column(type="string", nullable=true)
 */
public $private_key;

On ->save() I get the following message :

private_key is required

Are nullable and required considered seperate?



98.9k

Maybe the annotations strategy is not correctly set up?



2.9k

I pretty much copied this verbatim:

https://docs.phalcon.io/en/latest/reference/models.html#annotations-strategy

Was there other config / include / setup needed?



2.9k
Accepted
answer

You were of course correct. I was missing the comment for the class, once added worked fine.

I'm encountering the same problem. The link winmutt gave is dead and all class annotations I tried didn't solve it