public function revert(array $migrations) { $migrations = $this->sort($migrations, SORT_DESC); $reverteds = 0; try { foreach ($migrations as $migration) { $this->query->begin(); if (!$this->storage->isAppliedVersion($migration->version)) { $this->logger->log(sprintf('Revert migration skipped, Already reverted.: {system:"%s", version:"%s"}', $this->storage->system, $migration->version)); continue; } $migration->down(); $migration->applied = false; $this->storage->markReverted($migration->version); $this->query->commit(); $this->logger->log(sprintf('Revert migration successful: {system:"%s", version:"%s"}', $this->storage->system, $migration->version)); $reverteds++; } $this->query->commit(); } catch (Exception $e) { if ($this->query->inTransaction()) { $this->query->rollback(); } $this->logger->log(sprintf('Revert migration failed: {system:"%s", version:"%s"}', $this->storage->system, $migration->version)); throw $e; } return $reverteds; }
/** * 受注テーブルの論理削除 */ function lfDelete($arrOrderId) { $objQuery = new SC_Query_Ex(); if (!isset($arrOrderId) || !is_array($arrOrderId)) { return false; } $arrUpdate = array('del_flg' => 1, 'update_date' => 'CURRENT_TIMESTAMP'); $objQuery->begin(); foreach ($arrOrderId as $orderId) { $objQuery->update('dtb_order', $arrUpdate, 'order_id = ?', array($orderId)); } $objQuery->commit(); $this->tpl_onload = "window.alert('選択項目を削除しました。');"; return true; }
function lfDeleteFavoriteProduct($customer_id, $product_id) { $objQuery = new SC_Query_Ex(); $count = $objQuery->count("dtb_customer_favorite_products", "customer_id = ? AND product_id = ?", array($customer_id, $product_id)); if ($count > 0) { $objQuery->begin(); $objQuery->delete('dtb_customer_favorite_products', "customer_id = ? AND product_id = ?", array($customer_id, $product_id)); $objQuery->commit(); } }