0

I have problem with my query. It's working fine in this form:

$sql = "SET @i:=0; UPDATE movie m SET m.priority=@i:=@i+1 WHERE m.id IN (". $idsString . ") ORDER BY FIELD(m.id,". $idsString . ")";
$this->getEntityManager()->getConnection()->prepare($sql)->execute();

But imo it's not looking fine. When I'm trying to use bindParam() (ofc i'm changing parameters to :ids) I don't get error but priorities are not updated. Set parameters in execute don't work because it throw error about array to strig conversion. I'm doing something wrong or it's other way to do this?

jager91
  • 272
  • 6
  • 15

0 Answers0