1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
<?php
MainFactory::load_class('CustomerDeleterInterface');
class CustomerDeleter implements CustomerDeleterInterface
{
protected $db;
public function __construct(CI_DB_query_builder $dbQueryBuilder)
{
$this->db = $dbQueryBuilder;
}
public function delete(CustomerInterface $customer)
{
$customerId = (int)(string)$customer->getId();
$this->db->delete('address_book', array('customers_id' => $customerId));
$this->db->query('DELETE FROM `admin_access` WHERE `customers_id` = "' . $customerId . '"');
$this->db->delete('customers', array('customers_id' => $customerId));
$this->db->delete('customers_basket', array('customers_id' => $customerId));
$this->db->delete('customers_basket_attributes', array('customers_id' => $customerId));
$this->db->delete('customers_info', array('customers_info_id' => $customerId));
$this->db->delete('customers_ip', array('customers_id' => $customerId));
$this->db->delete('customers_status_history', array('customers_id' => $customerId));
$this->db->delete('customers_wishlist', array('customers_id' => $customerId));
$this->db->delete('customers_wishlist_attributes', array('customers_id' => $customerId));
$this->db->delete('coupon_gv_customer', array('customer_id' => $customerId));
$this->db->delete('coupon_gv_queue', array('customer_id' => $customerId));
$this->db->delete('coupon_redeem_track', array('customer_id' => $customerId));
$this->db->delete('gm_gprint_cart_elements', array('customers_id' => $customerId));
$this->db->delete('gm_gprint_wishlist_elements', array('customers_id' => $customerId));
$this->db->delete('products_notifications', array('customers_id' => $customerId));
$this->db->delete('whos_online', array('customer_id' => $customerId));
$this->db->update('coupon_redeem_track', array('customer_id' => 0), array('customer_id' => $customerId));
$this->db->update('gm_gprint_uploads', array('customers_id' => 0), array('customers_id' => $customerId));
$this->db->update('newsletter_recipients', array('customers_id' => 0), array('customers_id' => $customerId));
$this->db->update('orders', array('customers_id' => 0), array('customers_id' => $customerId));
$this->db->update('withdrawals', array('customer_id' => 0), array('customer_id' => $customerId));
return $this;
}
}