当前位置: 首页>>代码示例>>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;未经允许,请勿转载。