I'm having some trouble performing an PHQL UPDATE query.
I'd like to perform a bulk update on a model, setting statusId
to 1
and dateAssigned
to NOW()
only where dateAssigned
is currently NULL
.
Any advice, solution, or insight as to what is going on? I'm on Phalcon 2.0.10
What I want
This sets statusId correctly, but never sets dateAssigend
$phql = 'UPDATE \Domain\Model\User SET statusId = :statusId:, dateAssigned = IFNULL(dateAssigned, NOW()) WHERE id IN (1, 2, 3)';
$manager->createQuery($phql)->execute(array(
'statusId' => 1
));
Simlified version
This sets statusId correctly, but never sets dateAssigned
$phql = 'UPDATE \Domain\Model\User SET statusId = :statusId:, dateAssigned = NOW() WHERE id IN (1, 2, 3)';
$manager->createQuery($phql)->execute(array(
'statusId' => 1
));
Simplified version
This sets both correctly. But not what I want to do
$phql = 'UPDATE \Domain\Model\User SET statusId = :statusId:, dateAssigned = :dateAssigned: WHERE id IN (1, 2, 3)';
$manager->createQuery($phql)->execute(array(
'statusId' => 1,
'dateAssigned' => date('Y-m-d H:i:s')
));