Tôi muốn thiết null tới một lĩnh vực trong giáo lý và đây là câuLàm thế nào để cập nhật một trường trong học thuyết để thiết lập nó 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();
tôi nghĩ rằng mã này nên thực hiện công việc, nhưng im nhận này ngoại lệ
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»
trước hết lý do tại sao lại thêm VÀ (ví dụ.deleted_at IS NULL) tôi đang làm gì sai?
Tôi nghĩ rằng lỗi nằm trong "$ id" biến mà dường như không có một mảng ... – santamanno