Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 15 |
|
0.00% |
0 / 4 |
CRAP | |
0.00% |
0 / 1 |
| CustomerAlerts | |
0.00% |
0 / 15 |
|
0.00% |
0 / 4 |
56 | |
0.00% |
0 / 1 |
| __construct | |
0.00% |
0 / 5 |
|
0.00% |
0 / 1 |
6 | |||
| grabAlerts | |
0.00% |
0 / 8 |
|
0.00% |
0 / 1 |
12 | |||
| getAlertsArray | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| setAlertsArray | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace BuyerKiosk\Core; |
| 4 | |
| 5 | class CustomerAlerts extends Customer { |
| 6 | private $db; |
| 7 | |
| 8 | public $customerID; |
| 9 | public $alertsArray; |
| 10 | |
| 11 | public function __construct($customerID, $typeNum) { |
| 12 | parent::__construct($customerID, $typeNum); |
| 13 | $this->db = dbConnectByName($this->getDbName()); |
| 14 | if($this->grabAlerts()) |
| 15 | return true; |
| 16 | return false; |
| 17 | } |
| 18 | |
| 19 | public function grabAlerts() { |
| 20 | $stmt = $this->db->prepare("SELECT * FROM customerAlerts WHERE customerID = :customerID"); |
| 21 | $stmt->bindParam(":customerID", $this->customerID); |
| 22 | if($stmt->execute()){ |
| 23 | while($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { |
| 24 | $tempAlert = new \Alert($row['id'], $this->getTypeNum()); |
| 25 | $this->alertsArray[] = $tempAlert; |
| 26 | } |
| 27 | return true; |
| 28 | } |
| 29 | return false; |
| 30 | } |
| 31 | |
| 32 | /** |
| 33 | * @return mixed |
| 34 | */ |
| 35 | public function getAlertsArray() |
| 36 | { |
| 37 | return $this->alertsArray; |
| 38 | } |
| 39 | |
| 40 | /** |
| 41 | * @param mixed $alertsArray |
| 42 | */ |
| 43 | public function setAlertsArray($alertsArray) |
| 44 | { |
| 45 | $this->alertsArray = $alertsArray; |
| 46 | } |
| 47 | |
| 48 | } |