本文整理匯總了PHP中Doctrine\ORM\QueryBuilder::delete方法的典型用法代碼示例。如果您正苦於以下問題:PHP QueryBuilder::delete方法的具體用法?PHP QueryBuilder::delete怎麽用?PHP QueryBuilder::delete使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Doctrine\ORM\QueryBuilder
的用法示例。
在下文中一共展示了QueryBuilder::delete方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: removeNotifications
public function removeNotifications($user, $notificationType, $notificationDetails)
{
if ($notificationType === Notification::CONVERSATION_NOTIFICATION) {
$conversationId = $notificationDetails['conversation_id'];
$query = $this->qb->delete('NaidusvoeBundle:Notification', 'n')->where('n.userId=:uid')->setParameter('uid', $user->getId())->andWhere('n.conversationId=:convid')->setParameter('convid', $conversationId)->getQuery();
$query->execute();
}
}
示例2: configureQueryBuilder
/**
* {@inheritdoc}
*/
protected function configureQueryBuilder(QueryBuilder $queryBuilder)
{
$queryBuilder->delete();
}
示例3: delete
/**
* Delete a record from a table
*
*
* Ex: array('user_id'=>'1','id_site'=>'12');
* Raw SQL: * WHERE user_id='1' AND id_site='12'
*
* @param string $table
* @param array $condition
* @return integer Of Affected rows
*/
public function delete($table, array $condition)
{
$qbDelete = new QueryBuilder($this->getEntityManager());
$alias = $this->_getNewAlias();
//create a delete query for the given entity
$qbDelete->delete($table, $alias);
$first = true;
foreach ($condition as $column => $value) {
//remove alias and prepend own one
$column = $this->_removeAlias($column);
$column = $alias . '.' . $column;
$this->_addCondition($qbDelete, $column, '=', $value);
}
$return = $qbDelete->getQuery()->execute();
return $return;
}