Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

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.2k
Accepted
answer

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