order(['id DESC'])->fetchAll(); } public function getById($id) { return $this->where(['id = :id'], [':id' => $id])->fetch(); } public function getBySupplier($supplierId) { return $this->where(['supplier_id = :sid'], [':sid' => $supplierId])->order(['id DESC'])->fetchAll(); } public function getCount() { $sql = 'SELECT COUNT(*) AS cnt FROM ' . $this->getTable(); $stmt = $this->pdo->prepare($sql); $stmt->execute(); $row = $stmt->fetch(); return (int)($row['cnt'] ?? 0); } }