本文整理汇总了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;
}