Skip to content

Commit 07e3a3f

Browse files
authored
Merge pull request #17 from baldwin-agency/fix-issue-16
Adds a silly workaround to make this module work on Magento 2.4.2
2 parents 7cf1732 + 152a85a commit 07e3a3f

File tree

5 files changed

+61
-4
lines changed

5 files changed

+61
-4
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Baldwin\UrlDataIntegrityChecker\MagentoCoreBugFixes;
6+
7+
/**
8+
* Silly workaround for core Magento bug introduced in 2.4.2
9+
* - https://github.com/magento/magento2/issues/32292
10+
* - https://github.com/baldwin-agency/magento2-module-url-data-integrity-checker/issues/16
11+
*/
12+
class FakeSelectForMagentoIssue32292
13+
{
14+
/**
15+
* @return array<mixed>
16+
*/
17+
public function getPart(string $part): array
18+
{
19+
return [];
20+
}
21+
}

Model/ResourceModel/Catalog/Category/UrlKeyCollection.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
namespace Baldwin\UrlDataIntegrityChecker\Model\ResourceModel\Catalog\Category;
66

77
use Baldwin\UrlDataIntegrityChecker\Checker\Catalog\Category\UrlKey as UrlKeyChecker;
8+
use Baldwin\UrlDataIntegrityChecker\MagentoCoreBugFixes\FakeSelectForMagentoIssue32292 as FakeSelect;
89
use Baldwin\UrlDataIntegrityChecker\Storage\StorageInterface;
910
use Magento\Framework\Api\AttributeInterface;
1011
use Magento\Framework\Api\AttributeValue;
@@ -18,14 +19,17 @@
1819
class UrlKeyCollection extends DataCollection implements SearchResultInterface
1920
{
2021
private $storage;
22+
private $fakeSelect;
2123

2224
public function __construct(
2325
EntityFactoryInterface $entityFactory,
24-
StorageInterface $storage
26+
StorageInterface $storage,
27+
FakeSelect $fakeSelect
2528
) {
2629
parent::__construct($entityFactory);
2730

2831
$this->storage = $storage;
32+
$this->fakeSelect = $fakeSelect;
2933
}
3034

3135
/**
@@ -141,4 +145,9 @@ public function setTotalCount($totalCount)
141145
{
142146
throw new LocalizedException(__('Not implemented: setTotalCount!'));
143147
}
148+
149+
public function getSelect(): FakeSelect
150+
{
151+
return $this->fakeSelect;
152+
}
144153
}

Model/ResourceModel/Catalog/Category/UrlPathCollection.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
namespace Baldwin\UrlDataIntegrityChecker\Model\ResourceModel\Catalog\Category;
66

77
use Baldwin\UrlDataIntegrityChecker\Checker\Catalog\Category\UrlPath as UrlPathChecker;
8+
use Baldwin\UrlDataIntegrityChecker\MagentoCoreBugFixes\FakeSelectForMagentoIssue32292 as FakeSelect;
89
use Baldwin\UrlDataIntegrityChecker\Storage\StorageInterface;
910
use Magento\Framework\Api\AttributeInterface;
1011
use Magento\Framework\Api\AttributeValue;
@@ -18,14 +19,17 @@
1819
class UrlPathCollection extends DataCollection implements SearchResultInterface
1920
{
2021
private $storage;
22+
private $fakeSelect;
2123

2224
public function __construct(
2325
EntityFactoryInterface $entityFactory,
24-
StorageInterface $storage
26+
StorageInterface $storage,
27+
FakeSelect $fakeSelect
2528
) {
2629
parent::__construct($entityFactory);
2730

2831
$this->storage = $storage;
32+
$this->fakeSelect = $fakeSelect;
2933
}
3034

3135
/**
@@ -141,4 +145,9 @@ public function setTotalCount($totalCount)
141145
{
142146
throw new LocalizedException(__('Not implemented: setTotalCount!'));
143147
}
148+
149+
public function getSelect(): FakeSelect
150+
{
151+
return $this->fakeSelect;
152+
}
144153
}

Model/ResourceModel/Catalog/Product/UrlKeyCollection.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
namespace Baldwin\UrlDataIntegrityChecker\Model\ResourceModel\Catalog\Product;
66

77
use Baldwin\UrlDataIntegrityChecker\Checker\Catalog\Product\UrlKey as UrlKeyChecker;
8+
use Baldwin\UrlDataIntegrityChecker\MagentoCoreBugFixes\FakeSelectForMagentoIssue32292 as FakeSelect;
89
use Baldwin\UrlDataIntegrityChecker\Storage\StorageInterface;
910
use Magento\Framework\Api\AttributeInterface;
1011
use Magento\Framework\Api\AttributeValue;
@@ -18,14 +19,17 @@
1819
class UrlKeyCollection extends DataCollection implements SearchResultInterface
1920
{
2021
private $storage;
22+
private $fakeSelect;
2123

2224
public function __construct(
2325
EntityFactoryInterface $entityFactory,
24-
StorageInterface $storage
26+
StorageInterface $storage,
27+
FakeSelect $fakeSelect
2528
) {
2629
parent::__construct($entityFactory);
2730

2831
$this->storage = $storage;
32+
$this->fakeSelect = $fakeSelect;
2933
}
3034

3135
/**
@@ -141,4 +145,9 @@ public function setTotalCount($totalCount)
141145
{
142146
throw new LocalizedException(__('Not implemented: setTotalCount!'));
143147
}
148+
149+
public function getSelect(): FakeSelect
150+
{
151+
return $this->fakeSelect;
152+
}
144153
}

Model/ResourceModel/Catalog/Product/UrlPathCollection.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
namespace Baldwin\UrlDataIntegrityChecker\Model\ResourceModel\Catalog\Product;
66

77
use Baldwin\UrlDataIntegrityChecker\Checker\Catalog\Product\UrlPath as UrlPathChecker;
8+
use Baldwin\UrlDataIntegrityChecker\MagentoCoreBugFixes\FakeSelectForMagentoIssue32292 as FakeSelect;
89
use Baldwin\UrlDataIntegrityChecker\Storage\StorageInterface;
910
use Magento\Framework\Api\AttributeInterface;
1011
use Magento\Framework\Api\AttributeValue;
@@ -18,14 +19,17 @@
1819
class UrlPathCollection extends DataCollection implements SearchResultInterface
1920
{
2021
private $storage;
22+
private $fakeSelect;
2123

2224
public function __construct(
2325
EntityFactoryInterface $entityFactory,
24-
StorageInterface $storage
26+
StorageInterface $storage,
27+
FakeSelect $fakeSelect
2528
) {
2629
parent::__construct($entityFactory);
2730

2831
$this->storage = $storage;
32+
$this->fakeSelect = $fakeSelect;
2933
}
3034

3135
/**
@@ -141,4 +145,9 @@ public function setTotalCount($totalCount)
141145
{
142146
throw new LocalizedException(__('Not implemented: setTotalCount!'));
143147
}
148+
149+
public function getSelect(): FakeSelect
150+
{
151+
return $this->fakeSelect;
152+
}
144153
}

0 commit comments

Comments
 (0)