i'm having the following code:
/** @var DboSource $db */
$db = $this->getDataSource();
var_dump($db->value($open, 'boolean'));
die;
$this->query(
'INSERT INTO foo(`client_id`, `open`, `modified`, `created`) VALUES(:clientId, :open, NOW(), NOW()) ON DUPLICATE KEY UPDATE modified = now();',
[
':clientId' => $db->value($clientId, 'integer'),
':open' => $db->value($open, 'boolean')
]
);
$open
is a boolean value, the 'open'
-column is defined as tinyint(1)
. When wrapping $open with $db->value($open, 'boolean')
the result is '1'
, '0'
(see the single quotes).
Unfortunately this output leads to a new record with open = false
(as '1'
is not properly inserted as true
)
If I use $db->boolean($open)
as option, everything's working correctly.
But I think, $db->value()
should do the same job as well?