当前位置: 首页>>代码示例>>PHP>>正文


PHP QueryBuilder::delete方法代码示例

本文整理汇总了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();
     }
 }
开发者ID:riki343,项目名称:naidusvoe,代码行数:8,代码来源:Notifier.php

示例2: configureQueryBuilder

 /**
  * {@inheritdoc}
  */
 protected function configureQueryBuilder(QueryBuilder $queryBuilder)
 {
     $queryBuilder->delete();
 }
开发者ID:vespolina,项目名称:molino,代码行数:7,代码来源:DeleteQuery.php

示例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;
 }
开发者ID:ocpyosep78,项目名称:Booking,代码行数:27,代码来源:Doctrine2.php


注:本文中的Doctrine\ORM\QueryBuilder::delete方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。