Skip to content
This repository has been archived by the owner on Jul 22, 2022. It is now read-only.

Fix working with mssql #670

Merged
merged 1 commit into from
May 15, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -312,14 +312,14 @@ public function registerDoctrineMapping(array $config): void
'targetEntity' => $config['class']['product'],
'cascade' => [
'persist',
'remove',
],
'mappedBy' => null,
'inversedBy' => 'variations',
'joinColumns' => [
[
'name' => 'parent_id',
'referencedColumnName' => 'id',
'onDelete' => 'CASCADE',
],
],
'orphanRemoval' => false,
Expand Down
10 changes: 6 additions & 4 deletions src/ProductBundle/Entity/ProductCategoryManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,9 @@ public function getProductCount(CategoryInterface $category, $limit = 1000)
LEFT JOIN %s p ON pc.product_id = p.id
LEFT JOIN %s c ON pc.category_id = c.id
LEFT JOIN %s p2 ON p.id = p2.parent_id
WHERE p.enabled = :enabled
AND (p2.enabled = :enabled OR p2.enabled IS NULL)
AND (c.enabled = :enabled OR c.enabled IS NULL)
WHERE p.enabled = :productEnabled
AND (p2.enabled = :parentEnabled OR p2.enabled IS NULL)
AND (c.enabled = :categoryEnabled OR c.enabled IS NULL)
AND p.parent_id IS NULL
AND pc.category_id = :categoryId
LIMIT %d
Expand All @@ -107,7 +107,9 @@ public function getProductCount(CategoryInterface $category, $limit = 1000)
$sql = sprintf($sql, $metadata->table['name'], $productMetadata->table['name'], $categoryMetadata->table['name'], $productMetadata->table['name'], $limit);

$statement = $this->getConnection()->prepare($sql);
$statement->bindValue('enabled', 1);
$statement->bindValue('productEnabled', 1);
$statement->bindValue('parentEnabled', 1);
$statement->bindValue('categoryEnabled', 1);
$statement->bindValue('categoryId', $category->getId());

$statement->execute();
Expand Down