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 ORM, deactive quote encoding/conversion

Hi,

I'm looking for a way to save strings containing quotes in my database without these being automatically escaped/converted by the ORM, and still using models :)

I've looked a bit into what's happening down in the ORM, and it looks like the Phalcon\Mvc\Model\Query->_getExpression() method calls phalcon_orm_singlequotes() on all the strings, replacing single quotes by a html_entity version of it.

So the question is, how to configure Phalcon [or the models] so it doesn't automatically escape the quotes ? Thanks in advance.



24.7k

Update: Looking a bit more into it, and it come back to the "quoting" parameter in function _getExpression(var expr, boolean quoting = true)

Question stays the same: is there a way to have this "quoting" deactivated by default. Something to add in the model ? Overload service maybe ? I wouldn't like to have to use \Phalcon\Db\RawValue for each text field that may contain quotes...

Cheers