/** * @param Product $product */ private function saveDownloads($product) { if ($product->isDownloadsModified()) { $this->getDb()->query("DELETE FROM product_to_download WHERE product_id = '" . (int) $product->getId() . "'"); foreach ($product->getDownloads() as $download_id) { $this->getDb()->query("INSERT INTO product_to_download SET product_id = '" . (int) $product->getId() . "', download_id = '" . (int) $download_id . "'"); } } }