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.

SQL expressions via the Model?

Hi I've been trying to figure out how to utilize SQL expressions, for instance COALESCE() as well as any others of it's ilk , via the Model object? I've been reading the documentation but cannot find an example of such useage.



71.4k
Accepted
answer

Those are mysql only features and are not supported by phql. You have to use a dialect class. Similar question asked here: https://stackoverflow.com/questions/47972097/phalcon-datetime-in-model-query-error

Also you can search forum for similar problems and how to solve. Examples: https://forum.phalconphp.com/search?q=mysql+functions

Thanks. I was afraid of that but at least there appears to be a way around it.

Those are mysql only features and are not supported by phql. You have to use a dialect class. Similar question asked here: https://stackoverflow.com/questions/47972097/phalcon-datetime-in-model-query-error

Also you can search forum for similar problems and how to solve. Examples: https://forum.phalconphp.com/search?q=mysql+functions