本文整理汇总了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);
}
}
示例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');
}
}
示例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()]);
}
示例4: delete
public function delete($id)
{
$count = $this->db->delete($this->entityTable, array("id" => $id));
if ($count <= 0) {
throw new InvalidArgumentException("The delete failed.");
}
}
示例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;
}
}
示例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()));
}
示例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;
}
示例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()));
}
示例9: remove
/**
* {@inheritDoc}
*/
public function remove($key)
{
if (!$this->tableExists()) {
return;
}
$this->conn->delete(self::TABLE, array($this->keyColumn => $this->generateKey($key)));
}
示例10: unregisterNamespace
/**
* {@inheritDoc}
*/
public function unregisterNamespace($prefix)
{
$this->conn->delete('phpcr_namespaces', array('prefix' => $prefix));
if (!empty($this->namespaces)) {
unset($this->namespaces[$prefix]);
}
}
示例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);
}
示例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;
}
}
示例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);
}
示例14: remove
/**
* {@inheritdoc}
*/
public function remove($id)
{
try {
$this->connection->delete($this->tableName, [self::COLUMN_ID => $id]);
} catch (DBALException $e) {
throw DatabaseException::fromDBALException($e);
}
}
示例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()]);
}
}