Skip to content

Commit 6314ef9

Browse files
authored
Merge pull request #244 from PrestaShop/improve-sql-cast
Build 8.0.1
2 parents 9e6a1f6 + c8be391 commit 6314ef9

3 files changed

Lines changed: 8 additions & 6 deletions

File tree

config.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<module>
33
<name>productcomments</name>
44
<displayName><![CDATA[Product Comments]]></displayName>
5-
<version><![CDATA[8.0.0]]></version>
5+
<version><![CDATA[8.0.1]]></version>
66
<description><![CDATA[Allows users to post reviews and rate products on specific criteria.]]></description>
77
<author><![CDATA[PrestaShop]]></author>
88
<tab><![CDATA[front_office_features]]></tab>

productcomments.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public function __construct()
4747
{
4848
$this->name = 'productcomments';
4949
$this->tab = 'front_office_features';
50-
$this->version = '8.0.0';
50+
$this->version = '8.0.1';
5151
$this->author = 'PrestaShop';
5252
$this->need_instance = 0;
5353
$this->bootstrap = true;

src/Repository/ProductCommentCriterionRepository.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -159,12 +159,13 @@ public function update(ProductCommentCriterion $criterion): int
159159
private function updateCategories($criterion): int
160160
{
161161
$res = 0;
162-
$criterionId = $criterion->getId();
162+
$criterionId = (int) $criterion->getId();
163163
foreach ($criterion->getCategories() as $id_category) {
164164
$res += $this->connection->executeUpdate(
165165
'INSERT INTO `' .
166166
_DB_PREFIX_ . 'product_comment_criterion_category` (`id_product_comment_criterion`, `id_category`)
167-
VALUES(' . $criterionId . ',' . $id_category . ')'
167+
VALUES(?, ?)',
168+
[$criterionId, (int) $id_category]
168169
);
169170
}
170171

@@ -174,12 +175,13 @@ private function updateCategories($criterion): int
174175
private function updateProducts($criterion): int
175176
{
176177
$res = 0;
177-
$criterionId = $criterion->getId();
178+
$criterionId = (int) $criterion->getId();
178179
foreach ($criterion->getProducts() as $id_product) {
179180
$res += $this->connection->executeUpdate(
180181
'INSERT INTO `' .
181182
_DB_PREFIX_ . 'product_comment_criterion_product` (`id_product_comment_criterion`, `id_product`)
182-
VALUES(' . $criterionId . ',' . $id_product . ')'
183+
VALUES(?, ?)',
184+
[$criterionId, (int) $id_product]
183185
);
184186
}
185187

0 commit comments

Comments
 (0)