當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Connection::delete方法代碼示例

本文整理匯總了PHP中Doctrine\DBAL\Connection::delete方法的典型用法代碼示例。如果您正苦於以下問題:PHP Connection::delete方法的具體用法?PHP Connection::delete怎麽用?PHP Connection::delete使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Doctrine\DBAL\Connection的用法示例。


在下文中一共展示了Connection::delete方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: update

 /**
  * Update system data on databse
  *
  * @param array $system
  */
 public function update($system)
 {
     foreach ($system as $key => $value) {
         $this->databaseConnection->delete($this->systemTable, ['`key`' => $key]);
         $this->insert($key, $value);
     }
 }
開發者ID:hikmahtiar6,項目名稱:drafterbit,代碼行數:12,代碼來源:System.php

示例2: restorePortfolioTitle

 public function restorePortfolioTitle()
 {
     $totalPortfolioProcessed = 0;
     $nbPortfolioProcessed = 0;
     if ($this->connection->getSchemaManager()->tablesExist(array('icap__portfolio_widget_title'))) {
         $this->log('Restoring portfolio titles...');
         $rowPortfolioTitles = $this->connection->query('SELECT * FROM icap__portfolio_widget_title');
         $sql = 'SELECT aw.id, aw.user_id FROM icap__portfolio_abstract_widget aw WHERE id = :id';
         $stmt = $this->connection->prepare($sql);
         foreach ($rowPortfolioTitles as $rowPortfolioTitle) {
             $stmt->bindValue('id', $rowPortfolioTitle['id']);
             $stmt->execute();
             foreach ($stmt->fetchAll() as $rowAbstractWidget) {
                 $this->connection->update('icap__portfolio', ['title' => $rowPortfolioTitle['title'], 'slug' => $rowPortfolioTitle['slug']], ['id' => $rowAbstractWidget['user_id']]);
             }
             $this->connection->delete('icap__portfolio_abstract_widget', ['id' => $rowPortfolioTitle['id']]);
             ++$nbPortfolioProcessed;
             if ($nbPortfolioProcessed >= 10) {
                 $totalPortfolioProcessed += $nbPortfolioProcessed;
                 $nbPortfolioProcessed = 0;
                 $this->log('    processing portfolio...');
             }
         }
         $this->log(sprintf('  %d portfolio processed', $totalPortfolioProcessed + $nbPortfolioProcessed));
         $this->connection->delete('icap__portfolio_widget_type', ['name' => 'title']);
         $this->connection->getSchemaManager()->dropTable('icap__portfolio_widget_title');
     }
 }
開發者ID:claroline,項目名稱:distribution,代碼行數:28,代碼來源:Updater050002.php

示例3: onReminderWasAddedToTodo

 /**
  * @param ReminderWasAddedToTodo $event
  * @return void
  */
 public function onReminderWasAddedToTodo(ReminderWasAddedToTodo $event)
 {
     // remove other reminder for todo first
     $this->connection->delete(Table::TODO_REMINDER, ['todo_id' => $event->todoId()->toString()]);
     $reminder = $event->reminder();
     $this->connection->insert(Table::TODO_REMINDER, ['todo_id' => $event->todoId()->toString(), 'reminder' => $reminder->toString(), 'status' => $reminder->status()->toString()]);
 }
開發者ID:mikemix,項目名稱:proophessor-do,代碼行數:11,代碼來源:TodoReminderProjector.php

示例4: delete

 public function delete($id)
 {
     $count = $this->db->delete($this->entityTable, array("id" => $id));
     if ($count <= 0) {
         throw new InvalidArgumentException("The delete failed.");
     }
 }
開發者ID:konstantin-s,項目名稱:silex-lazycache,代碼行數:7,代碼來源:CacheRecordSQLMapper.php

示例5: _delete

 /**
  * @param array $criteria Criterios de la consulta DELETE adoptados en el WHERE
  *
  * @return int Filas afectadas
  */
 protected function _delete(array $criteria = array())
 {
     if (!is_null($this->_table)) {
         $this->_affectedRows = $this->_db->delete($this->_table, $criteria);
         return $this->_affectedRows;
     }
 }
開發者ID:simple-php-mvc,項目名稱:simple-php-mvc,代碼行數:12,代碼來源:DBALModel.php

示例6: delete

 /**
  * Deletes the order.
  *
  * @param \MusicBox\Entity\order $order
  */
 public function delete($order)
 {
     // If the order had an image, delete it.
     $image = $order->getImage();
     if ($image) {
         unlink('images/orders/' . $image);
     }
     return $this->db->delete('orders', array('order_id' => $order->getId()));
 }
開發者ID:maxromov,項目名稱:2hd,代碼行數:14,代碼來源:OrderRepository.php

示例7: delete

 public function delete(IEntity $entity)
 {
     $eventPre = new GenericEvent($entity);
     $this->eventDispatcher->dispatch("pre-delete-" . $this->entityName, $eventPre);
     $return = $this->db->delete($this->table, array("id" => $eventPre->getSubject()->getId()));
     $eventPost = new GenericEvent($eventPre->getSubject());
     $this->eventDispatcher->dispatch("post-delete-" . $this->entityName, new GenericEvent($eventPost));
     return $return;
 }
開發者ID:fabricekabongo,項目名稱:common,代碼行數:9,代碼來源:Repository.php

示例8: delete

 /**
  * Deletes the artist.
  *
  * @param \MusicBox\Entity\Artist $artist
  * @return boolean
  */
 public function delete($artist)
 {
     // If the artist had an image, delete it.
     $image = $artist->getImage();
     if ($image) {
         unlink('images/artists/' . $image);
     }
     return $this->db->delete('artists', array('artist_id' => $artist->getId()));
 }
開發者ID:juananruiz,項目名稱:musicbox,代碼行數:15,代碼來源:ArtistRepository.php

示例9: remove

 /**
  * {@inheritDoc}
  */
 public function remove($key)
 {
     if (!$this->tableExists()) {
         return;
     }
     $this->conn->delete(self::TABLE, array($this->keyColumn => $this->generateKey($key)));
 }
開發者ID:alinnflorinn,項目名稱:CraueFormFlowBundle,代碼行數:10,代碼來源:DoctrineStorage.php

示例10: unregisterNamespace

 /**
  * {@inheritDoc}
  */
 public function unregisterNamespace($prefix)
 {
     $this->conn->delete('phpcr_namespaces', array('prefix' => $prefix));
     if (!empty($this->namespaces)) {
         unset($this->namespaces[$prefix]);
     }
 }
開發者ID:viral810,項目名稱:ngSimpleCMS,代碼行數:10,代碼來源:Client.php

示例11: delete

 /**
  * Deletes a managed entity.
  *
  * The entity to delete must be managed and have a persistent identifier.
  * The deletion happens instantaneously.
  *
  * Subclasses may override this method to customize the semantics of entity deletion.
  *
  * @param object $entity The entity to delete.
  */
 public function delete($entity)
 {
     $identifier = $this->_em->getUnitOfWork()->getEntityIdentifier($entity);
     $this->deleteJoinTableRecords($identifier);
     $id = array_combine($this->_class->getIdentifierColumnNames(), $identifier);
     $this->_conn->delete($this->_class->getQuotedTableName($this->_platform), $id);
 }
開發者ID:jfkz,項目名稱:aquarel-cms,代碼行數:17,代碼來源:BasicEntityPersister.php

示例12: fixVersion

 /**
  * @param string $version
  * @param \DateTime $apply_at
  * @throws \Exception
  */
 public function fixVersion($version, \DateTime $apply_at = null)
 {
     if ($apply_at === null) {
         $apply_at = new \DateTime();
     }
     $this->createTable();
     $this->doctrine->beginTransaction();
     try {
         $this->doctrine->delete(self::TABLE_NAME, array('version' => $version));
         $this->doctrine->insert(self::TABLE_NAME, array('version' => $version, 'apply_at' => $apply_at->format('Y-m-d\\TH:i:s')));
         $this->doctrine->commit();
     } catch (\Exception $ex) {
         $this->doctrine->rollBack();
         throw $ex;
     }
 }
開發者ID:sickhye,項目名稱:php-db-migrate,代碼行數:21,代碼來源:DbTable.php

示例13: delete

 /**
  * {@inheritdoc}
  */
 public function delete($tableExpression, array $identifier, array $types = [])
 {
     $fixedIdentifier = [];
     foreach ($identifier as $columnName => $value) {
         $fixedIdentifier[$this->quoteIdentifier($columnName)] = $value;
     }
     return parent::delete($this->quoteIdentifier($tableExpression), $fixedIdentifier, $types);
 }
開發者ID:LidskaSila,項目名稱:Doctrine,代碼行數:11,代碼來源:Connection.php

示例14: remove

 /**
  * {@inheritdoc}
  */
 public function remove($id)
 {
     try {
         $this->connection->delete($this->tableName, [self::COLUMN_ID => $id]);
     } catch (DBALException $e) {
         throw DatabaseException::fromDBALException($e);
     }
 }
開發者ID:mnapoli,項目名稱:blackbox,代碼行數:11,代碼來源:DatabaseTable.php

示例15: saveUserTags

 public function saveUserTags(User $user)
 {
     $this->dbal->delete('userTags', ['user_id' => $user->getId()]);
     foreach ($user->getMentorTags() as $mentorTag) {
         echo 'Saving ' . $mentorTag->getName();
         $this->dbal->insert('userTags', ['user_id' => $user->getId(), 'term_id' => $mentorTag->getId()]);
     }
     foreach ($user->getApprenticeTags() as $apprenticeTag) {
         echo 'Saving ' . $apprenticeTag->getName();
         $this->dbal->insert('userTags', ['user_id' => $user->getId(), 'term_id' => $apprenticeTag->getId()]);
     }
 }
開發者ID:nickescobedo,項目名稱:webapp,代碼行數:12,代碼來源:UserService.php


注:本文中的Doctrine\DBAL\Connection::delete方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。