diff --git a/CHANGELOG.md b/CHANGELOG.md index 7ac8dab5c..f92c20393 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,6 @@ ## CHANGELOG FOR 1.1.x +#### 1.1.8 +- bugfix [#1848](https://github.com/ergonode/backend/issues/1848) Long response times for product grid endpoint (rprzedzik) #### 1.1.7 - bugfix [#1816](https://github.com/ergonode/backend/issues/1816) Fixed product audits (rprzedzik) diff --git a/module/product/src/Infrastructure/Grid/Builder/Query/AbstractAttributeDataSetBuilder.php b/module/product/src/Infrastructure/Grid/Builder/Query/AbstractAttributeDataSetBuilder.php index 7a8703c7a..f605565ac 100644 --- a/module/product/src/Infrastructure/Grid/Builder/Query/AbstractAttributeDataSetBuilder.php +++ b/module/product/src/Infrastructure/Grid/Builder/Query/AbstractAttributeDataSetBuilder.php @@ -30,8 +30,11 @@ public function addSelect(QueryBuilder $query, string $key, AbstractAttribute $a { $info = $this->query->getLanguageNodeInfo($this->resolver->resolve($attribute, $language)); - $sql = sprintf( - '(SELECT + if ($attribute->getScope()->isLocal()) { + $sql = sprintf( + ' + ( + SELECT DISTINCT ON (product_id) product_id, value AS "%s" FROM value_translation vt @@ -41,11 +44,28 @@ public function addSelect(QueryBuilder $query, string $key, AbstractAttribute $a AND lt.lft <= %s AND lt.rgt >= %s ORDER BY product_id, lft DESC NULLS LAST )', - $key, - $attribute->getId()->getValue(), - $info['lft'], - $info['rgt'], - ); + $key, + $attribute->getId()->getValue(), + $info['lft'], + $info['rgt'], + ); + } else { + $sql = sprintf( + ' + ( + SELECT + product_id, + value AS "%s" + FROM value_translation vt + JOIN product_value pv ON pv.value_id = vt.value_id + WHERE attribute_id = \'%s\' + AND language = \'%s\' + )', + $key, + $attribute->getId()->getValue(), + $info['code'], + ); + } $query->addSelect(sprintf('"%s"', $key)); $query->leftJoin('p', $sql, sprintf('"%s_JT"', $key), sprintf('"%s_JT".product_id = p.id', $key)); diff --git a/module/product/src/Infrastructure/Grid/Builder/Query/DateAttributeDataSetQueryBuilder.php b/module/product/src/Infrastructure/Grid/Builder/Query/DateAttributeDataSetQueryBuilder.php index fb217d7f4..1f4bfaef0 100644 --- a/module/product/src/Infrastructure/Grid/Builder/Query/DateAttributeDataSetQueryBuilder.php +++ b/module/product/src/Infrastructure/Grid/Builder/Query/DateAttributeDataSetQueryBuilder.php @@ -30,8 +30,11 @@ public function addSelect(QueryBuilder $query, string $key, AbstractAttribute $a { $info = $this->query->getLanguageNodeInfo($this->resolver->resolve($attribute, $language)); - $sql = sprintf( - '(SELECT + if ($attribute->getScope()->isLocal()) { + $sql = sprintf( + ' + ( + SELECT DISTINCT ON (product_id) product_id, value::DATE AS "%s" FROM value_translation vt @@ -41,11 +44,24 @@ public function addSelect(QueryBuilder $query, string $key, AbstractAttribute $a AND lt.lft <= %s AND lt.rgt >= %s ORDER BY product_id, lft DESC NULLS LAST )', - $key, - $attribute->getId()->getValue(), - $info['lft'], - $info['rgt'], - ); + $key, + $attribute->getId()->getValue(), + $info['lft'], + $info['rgt'], + ); + } else { + $sql = sprintf( + '( SELECT product_id, value::DATE AS "%s" + FROM value_translation vt + JOIN product_value pv ON pv.value_id = vt.value_id + WHERE attribute_id = \'%s\' + AND language = \'%s\' + )', + $key, + $attribute->getId()->getValue(), + $info['code'] + ); + } $query->addSelect(sprintf('"%s"', $key)); $query->leftJoin('p', $sql, sprintf('"%s_JT"', $key), sprintf('"%s_JT".product_id = p.id', $key)); diff --git a/module/product/src/Infrastructure/Grid/Builder/Query/FileAttributeDataSetQueryBuilder.php b/module/product/src/Infrastructure/Grid/Builder/Query/FileAttributeDataSetQueryBuilder.php index 9c0807afb..a323fa83e 100644 --- a/module/product/src/Infrastructure/Grid/Builder/Query/FileAttributeDataSetQueryBuilder.php +++ b/module/product/src/Infrastructure/Grid/Builder/Query/FileAttributeDataSetQueryBuilder.php @@ -31,8 +31,11 @@ public function addSelect(QueryBuilder $query, string $key, AbstractAttribute $a { $info = $this->query->getLanguageNodeInfo($this->resolver->resolve($attribute, $language)); - $sql = sprintf( - '(SELECT + if ($attribute->getScope()->isLocal()) { + $sql = sprintf( + ' + ( + SELECT DISTINCT ON (product_id) product_id, to_jsonb(regexp_split_to_array(value,\',\')) AS "%s" FROM value_translation vt @@ -42,11 +45,28 @@ public function addSelect(QueryBuilder $query, string $key, AbstractAttribute $a AND lt.lft <= %s AND lt.rgt >= %s ORDER BY product_id, lft DESC NULLS LAST )', - $key, - $attribute->getId()->getValue(), - $info['lft'], - $info['rgt'], - ); + $key, + $attribute->getId()->getValue(), + $info['lft'], + $info['rgt'], + ); + } else { + $sql = sprintf( + ' + ( + SELECT + product_id, + to_jsonb(regexp_split_to_array(value,\',\')) AS "%s" + FROM value_translation vt + JOIN product_value pv ON pv.value_id = vt.value_id + WHERE attribute_id = \'%s\' + AND language = \'%s\' + )', + $key, + $attribute->getId()->getValue(), + $info['code'], + ); + } $query->addSelect(sprintf('"%s"', $key)); $query->leftJoin('p', $sql, sprintf('"%s_JT"', $key), sprintf('"%s_JT".product_id = p.id', $key)); diff --git a/module/product/src/Infrastructure/Grid/Builder/Query/GalleryAttributeDataSetQueryBuilder.php b/module/product/src/Infrastructure/Grid/Builder/Query/GalleryAttributeDataSetQueryBuilder.php index 5239ab80f..aa52e13bc 100644 --- a/module/product/src/Infrastructure/Grid/Builder/Query/GalleryAttributeDataSetQueryBuilder.php +++ b/module/product/src/Infrastructure/Grid/Builder/Query/GalleryAttributeDataSetQueryBuilder.php @@ -31,22 +31,42 @@ public function addSelect(QueryBuilder $query, string $key, AbstractAttribute $a { $info = $this->query->getLanguageNodeInfo($this->resolver->resolve($attribute, $language)); - $sql = sprintf( - '(SELECT - DISTINCT ON (product_id) product_id, - to_jsonb(regexp_split_to_array(value,\',\')) AS "%s" - FROM value_translation vt + if ($attribute->getScope()->isLocal()) { + $sql = sprintf( + ' + ( + SELECT + DISTINCT ON (product_id) product_id, + to_jsonb(regexp_split_to_array(value,\',\')) AS "%s" + FROM value_translation vt JOIN product_value pv ON pv.value_id = vt.value_id LEFT JOIN language_tree lt ON lt.code = vt.language WHERE attribute_id = \'%s\' AND lt.lft <= %s AND lt.rgt >= %s ORDER BY product_id, lft DESC NULLS LAST )', - $key, - $attribute->getId()->getValue(), - $info['lft'], - $info['rgt'], - ); + $key, + $attribute->getId()->getValue(), + $info['lft'], + $info['rgt'], + ); + } else { + $sql = sprintf( + ' + ( + SELECT + product_id, + to_jsonb(regexp_split_to_array(value,\',\')) AS "%s" + FROM value_translation vt + JOIN product_value pv ON pv.value_id = vt.value_id + WHERE attribute_id = \'%s\' + AND language = \'%s\' + )', + $key, + $attribute->getId()->getValue(), + $info['code'], + ); + } $query->addSelect(sprintf('"%s"', $key)); $query->leftJoin('p', $sql, sprintf('"%s_JT"', $key), sprintf('"%s_JT".product_id = p.id', $key)); diff --git a/module/product/src/Infrastructure/Grid/Builder/Query/MultiSelectAttributeDataSetQueryBuilder.php b/module/product/src/Infrastructure/Grid/Builder/Query/MultiSelectAttributeDataSetQueryBuilder.php index c3067acdb..f93e7a85c 100644 --- a/module/product/src/Infrastructure/Grid/Builder/Query/MultiSelectAttributeDataSetQueryBuilder.php +++ b/module/product/src/Infrastructure/Grid/Builder/Query/MultiSelectAttributeDataSetQueryBuilder.php @@ -30,22 +30,42 @@ public function addSelect(QueryBuilder $query, string $key, AbstractAttribute $a { $info = $this->query->getLanguageNodeInfo($this->resolver->resolve($attribute, $language)); - $sql = sprintf( - '(SELECT - DISTINCT ON (product_id) product_id, - to_jsonb(regexp_split_to_array(value,\',\')) AS "%s" - FROM value_translation vt + if ($attribute->getScope()->isLocal()) { + $sql = sprintf( + ' + ( + SELECT + DISTINCT ON (product_id) product_id, + to_jsonb(regexp_split_to_array(value,\',\')) AS "%s" + FROM value_translation vt JOIN product_value pv ON pv.value_id = vt.value_id LEFT JOIN language_tree lt ON lt.code = vt.language WHERE attribute_id = \'%s\' AND lt.lft <= %s AND lt.rgt >= %s ORDER BY product_id, lft DESC NULLS LAST )', - $key, - $attribute->getId()->getValue(), - $info['lft'], - $info['rgt'], - ); + $key, + $attribute->getId()->getValue(), + $info['lft'], + $info['rgt'], + ); + } else { + $sql = sprintf( + ' + ( + SELECT + product_id, + to_jsonb(regexp_split_to_array(value,\',\')) AS "%s" + FROM value_translation vt + JOIN product_value pv ON pv.value_id = vt.value_id + WHERE attribute_id = \'%s\' + AND language = \'%s\' + )', + $key, + $attribute->getId()->getValue(), + $info['code'], + ); + } $query->addSelect(sprintf('"%s"', $key)); $query->leftJoin('p', $sql, sprintf('"%s_JT"', $key), sprintf('"%s_JT".product_id = p.id', $key)); diff --git a/module/product/src/Infrastructure/Grid/Builder/Query/NumericAttributeDataSetQueryBuilder.php b/module/product/src/Infrastructure/Grid/Builder/Query/NumericAttributeDataSetQueryBuilder.php index 122fa4706..b3706fdd8 100644 --- a/module/product/src/Infrastructure/Grid/Builder/Query/NumericAttributeDataSetQueryBuilder.php +++ b/module/product/src/Infrastructure/Grid/Builder/Query/NumericAttributeDataSetQueryBuilder.php @@ -29,23 +29,38 @@ public function supports(AbstractAttribute $attribute): bool public function addSelect(QueryBuilder $query, string $key, AbstractAttribute $attribute, Language $language): void { $info = $this->query->getLanguageNodeInfo($this->resolver->resolve($attribute, $language)); - - $sql = sprintf( - '(SELECT - DISTINCT ON (product_id) product_id, - value::NUMERIC AS "%s" - FROM value_translation vt + if ($attribute->getScope()->isLocal()) { + $sql = sprintf( + ' + ( + SELECT + DISTINCT ON (product_id) product_id, + value::NUMERIC AS "%s" + FROM value_translation vt JOIN product_value pv ON pv.value_id = vt.value_id LEFT JOIN language_tree lt ON lt.code = vt.language WHERE attribute_id = \'%s\' AND lt.lft <= %s AND lt.rgt >= %s ORDER BY product_id, lft DESC NULLS LAST )', - $key, - $attribute->getId()->getValue(), - $info['lft'], - $info['rgt'], - ); + $key, + $attribute->getId()->getValue(), + $info['lft'], + $info['rgt'], + ); + } else { + $sql = sprintf( + '(SELECT product_id, value::NUMERIC AS "%s" + FROM value_translation vt + JOIN product_value pv ON pv.value_id = vt.value_id + WHERE attribute_id = \'%s\' + AND language = \'%s\' + )', + $key, + $attribute->getId()->getValue(), + $info['code'] + ); + } $query->addSelect(sprintf('"%s"', $key)); $query->leftJoin('p', $sql, sprintf('"%s_JT"', $key), sprintf('"%s_JT".product_id = p.id', $key)); diff --git a/module/product/src/Infrastructure/Grid/Builder/Query/PriceAttributeDataSetQueryBuilder.php b/module/product/src/Infrastructure/Grid/Builder/Query/PriceAttributeDataSetQueryBuilder.php index c8654af23..4ff401955 100644 --- a/module/product/src/Infrastructure/Grid/Builder/Query/PriceAttributeDataSetQueryBuilder.php +++ b/module/product/src/Infrastructure/Grid/Builder/Query/PriceAttributeDataSetQueryBuilder.php @@ -30,22 +30,38 @@ public function addSelect(QueryBuilder $query, string $key, AbstractAttribute $a { $info = $this->query->getLanguageNodeInfo($this->resolver->resolve($attribute, $language)); - $sql = sprintf( - '(SELECT - DISTINCT ON (product_id) product_id, - value::NUMERIC AS "%s" - FROM value_translation vt + if ($attribute->getScope()->isLocal()) { + $sql = sprintf( + ' + ( + SELECT + DISTINCT ON (product_id) product_id, + value::NUMERIC AS "%s" + FROM value_translation vt JOIN product_value pv ON pv.value_id = vt.value_id LEFT JOIN language_tree lt ON lt.code = vt.language WHERE attribute_id = \'%s\' AND lt.lft <= %s AND lt.rgt >= %s ORDER BY product_id, lft DESC NULLS LAST )', - $key, - $attribute->getId()->getValue(), - $info['lft'], - $info['rgt'], - ); + $key, + $attribute->getId()->getValue(), + $info['lft'], + $info['rgt'], + ); + } else { + $sql = sprintf( + '(SELECT product_id, value::NUMERIC AS "%s" + FROM value_translation vt + JOIN product_value pv ON pv.value_id = vt.value_id + WHERE attribute_id = \'%s\' + AND language = \'%s\' + )', + $key, + $attribute->getId()->getValue(), + $info['code'] + ); + } $query->addSelect(sprintf('"%s"', $key)); $query->leftJoin('p', $sql, sprintf('"%s_JT"', $key), sprintf('"%s_JT".product_id = p.id', $key)); diff --git a/module/product/src/Infrastructure/Grid/Builder/Query/ProductRelationAttributeDataSetQueryBuilder.php b/module/product/src/Infrastructure/Grid/Builder/Query/ProductRelationAttributeDataSetQueryBuilder.php index cadefd0a9..fda974d6e 100644 --- a/module/product/src/Infrastructure/Grid/Builder/Query/ProductRelationAttributeDataSetQueryBuilder.php +++ b/module/product/src/Infrastructure/Grid/Builder/Query/ProductRelationAttributeDataSetQueryBuilder.php @@ -25,8 +25,9 @@ public function addSelect(QueryBuilder $query, string $key, AbstractAttribute $a { $info = $this->query->getLanguageNodeInfo($this->resolver->resolve($attribute, $language)); - $sql = sprintf( - '( + if ($attribute->getScope()->isLocal()) { + $sql = sprintf( + '( SELECT DISTINCT ON (product_id) product_id, to_jsonb(regexp_split_to_array(value,\',\')) AS "%s" @@ -37,11 +38,28 @@ public function addSelect(QueryBuilder $query, string $key, AbstractAttribute $a AND lt.lft <= %s AND lt.rgt >= %s ORDER BY product_id, lft DESC NULLS LAST )', - $key, - $attribute->getId()->getValue(), - $info['lft'], - $info['rgt'], - ); + $key, + $attribute->getId()->getValue(), + $info['lft'], + $info['rgt'], + ); + } else { + $sql = sprintf( + ' + ( + SELECT + product_id, + to_jsonb(regexp_split_to_array(value,\',\')) AS "%s" + FROM value_translation vt + JOIN product_value pv ON pv.value_id = vt.value_id + WHERE attribute_id = \'%s\' + AND language = \'%s\' + )', + $key, + $attribute->getId()->getValue(), + $info['code'], + ); + } $query->addSelect(sprintf('"%s"', $key)); $query->leftJoin('p', $sql, sprintf('"%s_JT"', $key), sprintf('"%s_JT".product_id = p.id', $key)); diff --git a/module/product/src/Infrastructure/Grid/Builder/Query/UnitAttributeDataSetQueryBuilder.php b/module/product/src/Infrastructure/Grid/Builder/Query/UnitAttributeDataSetQueryBuilder.php index 8f298de52..838479c77 100644 --- a/module/product/src/Infrastructure/Grid/Builder/Query/UnitAttributeDataSetQueryBuilder.php +++ b/module/product/src/Infrastructure/Grid/Builder/Query/UnitAttributeDataSetQueryBuilder.php @@ -30,8 +30,11 @@ public function addSelect(QueryBuilder $query, string $key, AbstractAttribute $a { $info = $this->query->getLanguageNodeInfo($this->resolver->resolve($attribute, $language)); - $sql = sprintf( - '(SELECT + if ($attribute->getScope()->isLocal()) { + $sql = sprintf( + ' + ( + SELECT DISTINCT ON (product_id) product_id, value::NUMERIC AS "%s" FROM value_translation vt @@ -41,11 +44,26 @@ public function addSelect(QueryBuilder $query, string $key, AbstractAttribute $a AND lt.lft <= %s AND lt.rgt >= %s ORDER BY product_id, lft DESC NULLS LAST )', - $key, - $attribute->getId()->getValue(), - $info['lft'], - $info['rgt'], - ); + $key, + $attribute->getId()->getValue(), + $info['lft'], + $info['rgt'], + ); + } else { + $sql = sprintf( + ' + ( + SELECT product_id, value::NUMERIC AS "%s" + FROM value_translation vt + JOIN product_value pv ON pv.value_id = vt.value_id + WHERE attribute_id = \'%s\' + AND language = \'%s\' + )', + $key, + $attribute->getId()->getValue(), + $info['code'] + ); + } $query->addSelect(sprintf('"%s"', $key)); $query->leftJoin('p', $sql, sprintf('"%s_JT"', $key), sprintf('"%s_JT".product_id = p.id', $key)); diff --git a/module/product/tests/Infrastructure/Grid/Builder/Query/DateAttributeDataSetQueryBuilderTest.php b/module/product/tests/Infrastructure/Grid/Builder/Query/DateAttributeDataSetQueryBuilderTest.php index 77ba4f897..9cf760f82 100644 --- a/module/product/tests/Infrastructure/Grid/Builder/Query/DateAttributeDataSetQueryBuilderTest.php +++ b/module/product/tests/Infrastructure/Grid/Builder/Query/DateAttributeDataSetQueryBuilderTest.php @@ -48,7 +48,7 @@ protected function setUp(): void $this->queryBuilder = $this->createMock(QueryBuilder::class); $this->language = $this->createMock(Language::class); $this->query = $this->createMock(LanguageQueryInterface::class); - $this->query->method('getLanguageNodeInfo')->willReturn(['lft' => 1, 'rgt' => 10]); + $this->query->method('getLanguageNodeInfo')->willReturn(['lft' => 1, 'rgt' => 10, 'code' => 'en_GB']); $this->resolver = new ProductAttributeLanguageResolver($this->query); } diff --git a/module/product/tests/Infrastructure/Grid/Builder/Query/ImageAttributeDataSetQueryBuilderTest.php b/module/product/tests/Infrastructure/Grid/Builder/Query/ImageAttributeDataSetQueryBuilderTest.php index fde4ee89f..a583c8c55 100644 --- a/module/product/tests/Infrastructure/Grid/Builder/Query/ImageAttributeDataSetQueryBuilderTest.php +++ b/module/product/tests/Infrastructure/Grid/Builder/Query/ImageAttributeDataSetQueryBuilderTest.php @@ -49,7 +49,7 @@ protected function setUp(): void $this->queryBuilder = $this->createMock(QueryBuilder::class); $this->language = $this->createMock(Language::class); $this->query = $this->createMock(LanguageQueryInterface::class); - $this->query->method('getLanguageNodeInfo')->willReturn(['lft' => 1, 'rgt' => 10]); + $this->query->method('getLanguageNodeInfo')->willReturn(['lft' => 1, 'rgt' => 10, 'code' => 'en_GB']); $this->resolver = new ProductAttributeLanguageResolver($this->query); } diff --git a/module/product/tests/Infrastructure/Grid/Builder/Query/MultiSelectAttributeDataSetQueryBuilderTest.php b/module/product/tests/Infrastructure/Grid/Builder/Query/MultiSelectAttributeDataSetQueryBuilderTest.php index f3afdd639..b5c4f8d7a 100644 --- a/module/product/tests/Infrastructure/Grid/Builder/Query/MultiSelectAttributeDataSetQueryBuilderTest.php +++ b/module/product/tests/Infrastructure/Grid/Builder/Query/MultiSelectAttributeDataSetQueryBuilderTest.php @@ -48,7 +48,7 @@ protected function setUp(): void $this->queryBuilder = $this->createMock(QueryBuilder::class); $this->language = $this->createMock(Language::class); $this->query = $this->createMock(LanguageQueryInterface::class); - $this->query->method('getLanguageNodeInfo')->willReturn(['lft' => 1, 'rgt' => 10]); + $this->query->method('getLanguageNodeInfo')->willReturn(['lft' => 1, 'rgt' => 10, 'code' => 'en_GB']); $this->resolver = new ProductAttributeLanguageResolver($this->query); } diff --git a/module/product/tests/Infrastructure/Grid/Builder/Query/NumericAttributeDataSetQueryBuilderTest.php b/module/product/tests/Infrastructure/Grid/Builder/Query/NumericAttributeDataSetQueryBuilderTest.php index 754d35e40..fb42db848 100644 --- a/module/product/tests/Infrastructure/Grid/Builder/Query/NumericAttributeDataSetQueryBuilderTest.php +++ b/module/product/tests/Infrastructure/Grid/Builder/Query/NumericAttributeDataSetQueryBuilderTest.php @@ -48,7 +48,7 @@ protected function setUp(): void $this->queryBuilder = $this->createMock(QueryBuilder::class); $this->language = $this->createMock(Language::class); $this->query = $this->createMock(LanguageQueryInterface::class); - $this->query->method('getLanguageNodeInfo')->willReturn(['lft' => 1, 'rgt' => 10]); + $this->query->method('getLanguageNodeInfo')->willReturn(['lft' => 1, 'rgt' => 10, 'code' => 'en_GB']); $this->resolver = new ProductAttributeLanguageResolver($this->query); } diff --git a/module/product/tests/Infrastructure/Grid/Builder/Query/PriceAttributeDataSetQueryBuilderTest.php b/module/product/tests/Infrastructure/Grid/Builder/Query/PriceAttributeDataSetQueryBuilderTest.php index f4381d416..4ee07952f 100644 --- a/module/product/tests/Infrastructure/Grid/Builder/Query/PriceAttributeDataSetQueryBuilderTest.php +++ b/module/product/tests/Infrastructure/Grid/Builder/Query/PriceAttributeDataSetQueryBuilderTest.php @@ -48,7 +48,7 @@ protected function setUp(): void $this->queryBuilder = $this->createMock(QueryBuilder::class); $this->language = $this->createMock(Language::class); $this->query = $this->createMock(LanguageQueryInterface::class); - $this->query->method('getLanguageNodeInfo')->willReturn(['lft' => 1, 'rgt' => 10]); + $this->query->method('getLanguageNodeInfo')->willReturn(['lft' => 1, 'rgt' => 10, 'code' => 'en_GB']); $this->resolver = new ProductAttributeLanguageResolver($this->query); } diff --git a/module/product/tests/Infrastructure/Grid/Builder/Query/SelectAttributeDataSetQueryBuilderTest.php b/module/product/tests/Infrastructure/Grid/Builder/Query/SelectAttributeDataSetQueryBuilderTest.php index 3cbf18ccf..bb07e4063 100644 --- a/module/product/tests/Infrastructure/Grid/Builder/Query/SelectAttributeDataSetQueryBuilderTest.php +++ b/module/product/tests/Infrastructure/Grid/Builder/Query/SelectAttributeDataSetQueryBuilderTest.php @@ -49,7 +49,7 @@ protected function setUp(): void $this->queryBuilder = $this->createMock(QueryBuilder::class); $this->language = $this->createMock(Language::class); $this->query = $this->createMock(LanguageQueryInterface::class); - $this->query->method('getLanguageNodeInfo')->willReturn(['lft' => 1, 'rgt' => 10]); + $this->query->method('getLanguageNodeInfo')->willReturn(['lft' => 1, 'rgt' => 10, 'code' => 'en_GB']); $this->resolver = new ProductAttributeLanguageResolver($this->query); } diff --git a/module/product/tests/Infrastructure/Grid/Builder/Query/TextAttributeDataSetQueryBuilderTest.php b/module/product/tests/Infrastructure/Grid/Builder/Query/TextAttributeDataSetQueryBuilderTest.php index e2f7e2e30..3c66a0c12 100644 --- a/module/product/tests/Infrastructure/Grid/Builder/Query/TextAttributeDataSetQueryBuilderTest.php +++ b/module/product/tests/Infrastructure/Grid/Builder/Query/TextAttributeDataSetQueryBuilderTest.php @@ -49,7 +49,7 @@ protected function setUp(): void $this->queryBuilder = $this->createMock(QueryBuilder::class); $this->language = $this->createMock(Language::class); $this->query = $this->createMock(LanguageQueryInterface::class); - $this->query->method('getLanguageNodeInfo')->willReturn(['lft' => 1, 'rgt' => 10]); + $this->query->method('getLanguageNodeInfo')->willReturn(['lft' => 1, 'rgt' => 10, 'code' => 'en_GB']); $this->resolver = new ProductAttributeLanguageResolver($this->query); } diff --git a/module/product/tests/Infrastructure/Grid/Builder/Query/TextareaAttributeDataSetQueryBuilderTest.php b/module/product/tests/Infrastructure/Grid/Builder/Query/TextareaAttributeDataSetQueryBuilderTest.php index 31819e669..18044b844 100644 --- a/module/product/tests/Infrastructure/Grid/Builder/Query/TextareaAttributeDataSetQueryBuilderTest.php +++ b/module/product/tests/Infrastructure/Grid/Builder/Query/TextareaAttributeDataSetQueryBuilderTest.php @@ -49,7 +49,7 @@ protected function setUp(): void $this->queryBuilder = $this->createMock(QueryBuilder::class); $this->language = $this->createMock(Language::class); $this->query = $this->createMock(LanguageQueryInterface::class); - $this->query->method('getLanguageNodeInfo')->willReturn(['lft' => 1, 'rgt' => 10]); + $this->query->method('getLanguageNodeInfo')->willReturn(['lft' => 1, 'rgt' => 10, 'code' => 'en_GB']); $this->resolver = new ProductAttributeLanguageResolver($this->query); } diff --git a/module/product/tests/Infrastructure/Grid/Builder/Query/UnitAttributeDataSetQueryBuilderTest.php b/module/product/tests/Infrastructure/Grid/Builder/Query/UnitAttributeDataSetQueryBuilderTest.php index 88c9a06f2..41bcbde3d 100644 --- a/module/product/tests/Infrastructure/Grid/Builder/Query/UnitAttributeDataSetQueryBuilderTest.php +++ b/module/product/tests/Infrastructure/Grid/Builder/Query/UnitAttributeDataSetQueryBuilderTest.php @@ -48,7 +48,7 @@ protected function setUp(): void $this->queryBuilder = $this->createMock(QueryBuilder::class); $this->language = $this->createMock(Language::class); $this->query = $this->createMock(LanguageQueryInterface::class); - $this->query->method('getLanguageNodeInfo')->willReturn(['lft' => 1, 'rgt' => 10]); + $this->query->method('getLanguageNodeInfo')->willReturn(['lft' => 1, 'rgt' => 10, 'code' => 'en_GB']); $this->resolver = new ProductAttributeLanguageResolver($this->query); }