6

我如何DELETE FROM table WHERE id = 2在 Zend 的学说 2 中编写查询?

$this->_em->getrepository(something\entitity\something\table)->remove()->where('id',2) ?
4

1 回答 1

6

删除查询

$repository = $this->_em->getRepository('My\\Entity');
$query = $repository->createQuery('DELETE FROM entity e WHERE e.id = ?1');
$query->setParameter(1, $id);
$query->execute();
于 2013-06-19T09:40:07.013 回答