public function testDeleteByProductIDs_複数データが削除される() { $objHelperBestProducts = new SC_Helper_BestProducts_Ex(); $objHelperBestProducts->deleteByProductIDs(array("2", "3")); $this->expected = null; $this->actual = $objHelperBestProducts->getBestProducts('1001'); $this->verify(); $this->actual = $objHelperBestProducts->getBestProducts('1003'); $this->verify(); }
/** * 商品、子テーブル(商品規格)、お気に入り商品の削除 * * @param string $where 削除対象の WHERE 句 * @param array $arrParam 削除対象の値 * @return void */ public function doDelete($where, $arrParam = array()) { $objQuery =& SC_Query_Ex::getSingletonInstance(); $product_ids = $objQuery->getCol('product_id', "dtb_products", $where, $arrParam); $sqlval['del_flg'] = 1; $sqlval['update_date'] = 'CURRENT_TIMESTAMP'; $objQuery->begin(); $objQuery->update('dtb_products_class', $sqlval, "product_id IN (SELECT product_id FROM dtb_products WHERE {$where})", $arrParam); $objQuery->delete('dtb_customer_favorite_products', "product_id IN (SELECT product_id FROM dtb_products WHERE {$where})", $arrParam); $objRecommend = new SC_Helper_BestProducts_Ex(); $objRecommend->deleteByProductIDs($product_ids); $objQuery->update('dtb_products', $sqlval, $where, $arrParam); $objQuery->commit(); }