How do i write a query DELETE FROM table WHERE id = 2
in doctrine2 in Zend ?
$this->_em->getrepository(something\entitity\something\table)->remove()->where('id',2) ?
$repository = $this->_em->getRepository('My\\Entity');
$query = $repository->createQuery('DELETE FROM entity e WHERE e.id = ?1');
$query->setParameter(1, $id);
$query->execute();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With