Hi,
When saving model data I'm getting this notice: Cannot use a scalar value as an array in phalcon/mvc/model.zep on line 1194.
The problem happens when I specify PDO::ATTR_DEFAULT_FETCH_MODE=>PDO::FETCH_OBJ when creating the PDO object. BTW, the record gets saved properly, but it generates the notice. When I remove that option, the notice is gone.
Does anyone know how I can get it fixed and still fetch my results as objects?
Here's my setup:
Phalcon 3.4.0, Linux Mint 18.3, Mysql 5.7.23
Here's a simple test case:
$di = new \Phalcon\DI\FactoryDefault();
$di->set('db', function() {
return new \Phalcon\Db\Adapter\Pdo\Mysql([
"host" => "localhost",
"username" => "...",
"password" => "...",
"dbname" => "...",
"options" => [
PDO::ATTR_DEFAULT_FETCH_MODE=>PDO::FETCH_OBJ,
],
]);
});
class AffiliateSettings extends \Phalcon\Mvc\Model
{
}
$settings = new AffiliateSettings();
$settings->user_id = rand(1, 9999);
$settings->save(); // <-- notice generated here
The MySQL table:
CREATE TABLE affiliate_settings (
user_id INT UNSIGNED NOT NULL,
enabled TINYINT(1) NOT NULL DEFAULT 1,
PRIMARY KEY (user_id)
) ENGINE = InnoDB DEFAULT CHARSET utf8 COLLATE utf8_unicode_ci;