-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathOrderContr.class.php
More file actions
26 lines (21 loc) · 800 Bytes
/
OrderContr.class.php
File metadata and controls
26 lines (21 loc) · 800 Bytes
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
<?php
class OrderContr extends Dbhandler {
private $orderID;
/** @var OrderItemContr[] $orderItems */
private $orderItems;
function __construct($orderID) {
$this->orderID = $orderID;
$this->updateOrderItems();
}
// update order items related to this order
protected function updateOrderItems() {
$sql = "SELECT OrderItemID FROM OrderItems WHERE ORDERID = '$this->orderID'";
$result = $this->conn()->query($sql) or die($this->conn()->error);
// create multiple OrderItem instances
$this->orderItems = array();
while ($row = $result->fetch_assoc())
array_push($this->orderItems, new OrderItemContr($row["OrderItemID"]));
}
public function getOrderID() { return $this->orderID; }
public function getOrderItems() { return $this->orderItems; }
}