Upgrade Phalcon From version 2 to 3

Hello My App Upgraded

From * php 5.6 * phalcon 2 * apache + fast-cgi To * php 7.0 * Phalcon 3 * Nginx + php-fpm

When this upgrade occured.

my app have many DB errors like this database errors :

    SQLSTATE[22001]: String data, right truncated: 1406 Data too long for column '***' at row 1
    SQLSTATE[HY000]: General error: 1366 Incorrect integer value: '' for column '***' at row 1

if set 0 instead of null for integer values in models this error can be fix.

How to fix it generally?



64.0k

for mysql 5.7 you need to follow the protocol. if a column is int/date you need give int/ proper date values

MySQL Documentation 5.7 says:

Strict mode affects whether the server permits 0000-00-00 as a valid date: If strict mode is not enabled, 0000-00-00 is permitted and inserts produce no warning. If strict mode is enabled, 0000-00-00 is not permitted and inserts produce an error, unless IGNORE is given as well. For INSERT IGNORE and UPDATE IGNORE, 0000-00-00 is permitted and inserts produce a warning.