diff --git a/src/ORM/Connect/MySQLDatabase.php b/src/ORM/Connect/MySQLDatabase.php index c1900488519..ebecab41749 100644 --- a/src/ORM/Connect/MySQLDatabase.php +++ b/src/ORM/Connect/MySQLDatabase.php @@ -49,6 +49,16 @@ class MySQLDatabase extends Database implements TransactionManager */ private static $charset = 'utf8'; + /** + * SQL Mode used on connections to MySQL. Defaults to ANSI. For basic ORM + * compatibility, this setting must always include ANSI or ANSI_QUOTES. + * + * @config + * @var string + */ + private static $sql_mode = 'ANSI'; + + /** * Cache for getTransactionManager() * @@ -84,8 +94,8 @@ public function connect($parameters) // Notify connector of parameters $this->connector->connect($parameters); - // This is important! - $this->setSQLMode('ANSI'); + // Set sql_mode + $this->setSQLMode(static::config()->get('sql_mode')); if (isset($parameters['timezone'])) { $this->selectTimezone($parameters['timezone']);