Skip to content

Commit

Permalink
Added core compatibility layer
Browse files Browse the repository at this point in the history
  • Loading branch information
Morgan Pichat committed Aug 1, 2023
1 parent 70d2bba commit b21ead5
Showing 1 changed file with 10 additions and 16 deletions.
26 changes: 10 additions & 16 deletions src/Repository/ProductCommentRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ public function paginate($productId, $page, $commentsPerPage, $validatedOnly)
;
}

return $qb->executeQuery()->fetchAllAssociative();
return $qb->execute()->fetchAllAssociative();
}

/**
Expand All @@ -131,7 +131,7 @@ public function getProductCommentUsefulness($productCommentId)
'usefulness' => 0,
'total_usefulness' => 0,
];
$customerAppreciations = $qb->executeQuery()->fetchAllAssociative();
$customerAppreciations = $qb->execute()->fetchAllAssociative();
foreach ($customerAppreciations as $customerAppreciation) {
if ((int) $customerAppreciation['usefulness']) {
++$usefulnessInfos['usefulness'];
Expand Down Expand Up @@ -204,10 +204,7 @@ public function getAverageGrades(array $productIds, $validatedOnly)

$sql .= ' FROM ' . $this->databasePrefix . 'product_comment';

$query = $this->connection->prepare($sql);
$result = $query->executeQuery();

return (array) $result->fetchAssociative();
return $this->connection->executeQuery($sql)->fetchAssociative();
}

/**
Expand Down Expand Up @@ -236,7 +233,7 @@ public function getCommentsNumber($productId, $validatedOnly)
;
}

return (int) $qb->executeQuery()->fetchOne();
return (int) $qb->execute()->fetchOne();
}

/**
Expand Down Expand Up @@ -267,10 +264,7 @@ public function getCommentsNumberForProducts(array $productIds, $validatedOnly)

$sql .= ' FROM ' . $this->databasePrefix . 'product_comment';

$query = $this->connection->prepare($sql);
$result = $query->executeQuery();

return (array) $result->fetchAssociative();
return (array) $this->connection->executeQuery($sql)->fetchAssociative();
}

/**
Expand Down Expand Up @@ -338,7 +332,7 @@ public function cleanCustomerData($customerId)
->andWhere('pc.id_customer = :id_customer')
->setParameter('id_customer', $customerId)
;
$qb->executeStatement();
$qb->execute();

//But we remove every report and votes for comments
$qb = $this->connection->createQueryBuilder();
Expand All @@ -347,15 +341,15 @@ public function cleanCustomerData($customerId)
->andWhere('id_customer = :id_customer')
->setParameter('id_customer', $customerId)
;
$qb->executeStatement();
$qb->execute();

$qb = $this->connection->createQueryBuilder();
$qb
->delete($this->databasePrefix . 'product_comment_usefulness')
->andWhere('id_customer = :id_customer')
->setParameter('id_customer', $customerId)
;
$qb->executeStatement();
$qb->execute();
}

/**
Expand All @@ -382,7 +376,7 @@ public function getCustomerData($customerId, $langId)
->addOrderBy('pc.date_add', 'ASC')
;

return $qb->executeQuery()->fetchAllAssociative();
return $qb->execute()->fetchAllAssociative();
}

/**
Expand Down Expand Up @@ -410,7 +404,7 @@ private function getLastComment(array $criteria)
;
}

$comments = $qb->executeQuery()->fetchAllAssociative();
$comments = $qb->execute()->fetchAllAssociative();

return empty($comments) ? [] : $comments[0];
}
Expand Down

0 comments on commit b21ead5

Please sign in to comment.