order(['id DESC'])->fetchAll(); } public function getById($id) { return $this->where(['id = :id'], [':id' => $id])->fetch(); } public function getCount() { $sql = 'SELECT COUNT(*) AS cnt, SUM(purchase_price * quantity) AS total_value FROM ' . $this->getTable(); $stmt = $this->pdo->prepare($sql); $stmt->execute(); return $stmt->fetch(); } public function getByStatus($status) { return $this->where(['status = :st'], [':st' => $status])->order(['id DESC'])->fetchAll(); } }