1 <?php
2
3 /* --------------------------------------------------------------
4 OrderTotalRepositoryDeleter.inc.php 2015-11-10
5 Gambio GmbH
6 http://www.gambio.de
7 Copyright (c) 2015 Gambio GmbH
8 Released under the GNU General Public License (Version 2)
9 [http://www.gnu.org/licenses/gpl-2.0.html]
10 --------------------------------------------------------------
11 */
12
13 /**
14 * Class OrderTotalRepositoryDeleter
15 *
16 * @category System
17 * @package Order
18 * @subpackage Repositories
19 */
20 class OrderTotalRepositoryDeleter implements OrderTotalRepositoryDeleterInterface
21 {
22 /**
23 * Query builder.
24 * @var CI_DB_query_builder
25 */
26 protected $db;
27
28
29 /**
30 * OrderTotalRepositoryDeleter constructor.
31 *
32 * @param CI_DB_query_builder $dbQueryBuilder Query builder.
33 */
34 public function __construct(CI_DB_query_builder $dbQueryBuilder)
35 {
36 $this->db = $dbQueryBuilder;
37 }
38
39
40 /**
41 * Removes an order total item by the given order total ID.
42 *
43 * @param IdType $orderTotalId Order total ID.
44 *
45 * @return OrderTotalRepositoryDeleter Same instance for method chaining.
46 */
47 public function deleteTotalById(IdType $orderTotalId)
48 {
49 $this->db->delete('orders_total', array('orders_total_id' => $orderTotalId->asInt()));
50
51 return $this;
52 }
53
54
55 /**
56 * Removes all order totals which are associated with the given order ID.
57 *
58 * @param IdType $orderId Order ID.
59 *
60 * @return OrderTotalRepositoryDeleter Same instance for method chaining.
61 */
62 public function deleteTotalsByOrderId(IdType $orderId)
63 {
64 $this->db->delete('orders_total', array('orders_id' => $orderId->asInt()));
65
66 return $this;
67 }
68 }