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

Model findFirst collations

I have a table column (pid) which is set to ascii_bin as collation, and when I run findFirstByPid, I get a general mysql error: #1267: Illegal mix of collations (ascii_bin,IMPLICIT) and (utf8_general_ci,COERCIBLE) for operation "="

Is there a way to circumvent this, or do I have to refactor it as a PHQL query?

(MariaDB 10, Phalcon 2.0.13)



77.7k
Accepted
answer
edited Apr '17

Sorry, as it turns out, it has nothing to do with Phalcon.

The code works fine if the findFirst parameter can be converted to ascii, but will throw this fit if it contains unmappable characters (which makes sense). Unfortunately the data vendor we are interfacing missed the whole point of unique identifiers, and uses accented characters for location ids...

Changing the charset to utf8_bin worked.