pdo = new \PDO("sqlite:" . $dbPath); $this->pdo->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION); } public function getDescriptionsByCompany(int $companyId): array { $stmt = $this->pdo->prepare(" SELECT d.description_id, d.description_text, d.product_id FROM description d WHERE d.company_id = :company_id "); $stmt->execute(['company_id' => $companyId]); return $stmt->fetchAll(\PDO::FETCH_ASSOC); } public function addDescription(int $productId, int $companyId, string $text): bool { $stmt = $this->pdo->prepare(" INSERT INTO description (description_text, product_id, company_id) VALUES (:text, :product_id, :company_id) "); return $stmt->execute([ 'text' => $text, 'product_id' => $productId, 'company_id' => $companyId, ]); } public function updateDescription(int $descriptionId, string $text): bool { $stmt = $this->pdo->prepare(" UPDATE description SET description_text = :text WHERE description_id = :id "); return $stmt->execute([ 'text' => $text, 'id' => $descriptionId, ]); } }