當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。