Drupal db_update not working, unless intentional error through batch API -
i'm submitting form view through drupal batch api update row in db. statement use is:
db_update('scores') ->fields(['status' => 0]) ->condition('sid', $score->sid) ->execute();
the batch returns , gives me feedback of
performed undo publishing on 1 item.
however, row in db not updated.
when using following code:
$result = db_update('scores') ->fields(['status' => 0]) ->condition('sid', $score->sid) ->execute(); drq($result);
the batch api returns error due unexpected output, , after refreshing page manually, row in question is updated!
i can't life of me figure out what's going on nor how query batch api log somewhere can see what's going on.
any appreciated.
it seems there's 2 queries being executed. 1 db_update
statement described earlier, , 1 entity.controller.inc::save()
in entity module. latter started transaction negated db_update
action.
i changed code following
db_update('scores') ->fields(['status' => 0]) ->condition('sid', $score->sid) ->execute(); $score->status = 0; $score->save();
and works intended. status of item gets changed in db , seems well. know ugly workaround actual problem, @ moment it's solution can find.
Comments
Post a Comment