CRM-1659: Implement DoctrineExtensions for Oro - fixed CAST to INT for older versions of mysql