我想設置爲null,在教義字段更新場,這裏是一句如何學說將其設置爲null
$em = $this->getDoctrine()->getManager();
$qb = $em->createQueryBuilder();
$query = $qb->update('Model\Example', 'u')->set('u.deletedAt', ':deletedAt')
->where("u.id IN (:ids)")->setParameter('deletedAt', null)
->setParameter('ids', $ids)
->getQuery();
$query->execute();
我認爲這個代碼應該做的工作,但即時得到這個例外
An exception occurred while executing 'UPDATE example SET deleted_at = ? WHERE (id IN (?)) AND (example.deleted_at IS NULL)' with params [null, "5,6"]: SQLSTATE[22P02]: Invalid text representation: 7 ERROR: la sintaxis de entrada no es válida para integer: «5,6»
首先爲什麼教義是添加AND(example.deleted_at IS NULL)我做錯了什麼?
我認爲錯誤在於「$ IDS」變量,它似乎並不爲數組... – santamanno