1 <?php
2 /* --------------------------------------------------------------
3 CustomerAddressDeleter.inc.php 2015-02-18 gm
4 Gambio GmbH
5 http://www.gambio.de
6 Copyright (c) 2015 Gambio GmbH
7 Released under the GNU General Public License (Version 2)
8 [http://www.gnu.org/licenses/gpl-2.0.html]
9 --------------------------------------------------------------
10 */
11
12 MainFactory::load_class('CustomerAddressDeleterInterface');
13
14 /**
15 * Class CustomerAddressDeleter
16 *
17 * This class is used for deleting customer address data
18 *
19 * @category System
20 * @package Customer
21 * @subpackage Address
22 *
23 * @implements CustomerAddressDeleterInterface
24 */
25 class CustomerAddressDeleter implements CustomerAddressDeleterInterface
26 {
27 /**
28 * @var CI_DB_query_builder
29 */
30 protected $db;
31
32
33 /**
34 * Constructor of the class CustomerAddressDeleter
35 *
36 * @param CI_DB_query_builder $dbQueryBuilder
37 */
38 public function __construct(CI_DB_query_builder $dbQueryBuilder)
39 {
40 $this->db = $dbQueryBuilder;
41 }
42
43 /**
44 * @param CustomerAddressInterface $customerAddress
45 */
46 public function delete(CustomerAddressInterface $customerAddress)
47 {
48 $this->db->delete('address_book', array('address_book_id' => (int)(string)$customerAddress->getId()));
49 }
50
51
52 /**
53 * @param CustomerInterface $customer
54 */
55 public function deleteByCustomer(CustomerInterface $customer)
56 {
57 $this->db->delete('address_book', array('customers_id' => (int)(string)$customer->getId()));
58 }
59
60 }