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

Phalcon models support for JSON fields

How is the Phalcon ORM support for JSON fields? How model properties map to JSON fields in the database? Are they simply treated as strings? I'm designing a database and have some JSON fields to simplify the design. Would I need to manually decode thoses JSON data fields? What about relationships? Anyone in a similar position? Ideas and examples are very welcomed. Thanks!



34.6k
Accepted
answer

They are treated as strings, but you can use afterFetch and beforeSave to transform properly for usage in the PHP userland.