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

metaData() for ODM ? Casting types for MongoDb

I have a string representating a value "8"(string) that I would like to store as an 8(int).

I can cast the value in beforeSave() but I would prefer to bind/cast to a different type as you can in a Database Model with the metaData() funciton.

Is this possible in ODM?



1.1k
Accepted
answer

It's currently not possible in the ODM, you have to use beforeSave()



47.7k