Skip to content

Commit a30a07e

Browse files
Merge pull request #6732 from engcom-Foxtrot/2.4-dev-php8-sync
2.4 dev php8 sync
2 parents b026746 + 7ec9943 commit a30a07e

File tree

310 files changed

+16865
-2734
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

310 files changed

+16865
-2734
lines changed

app/code/Magento/Authorization/Model/Role.php

Lines changed: 22 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -5,28 +5,32 @@
55
*/
66
namespace Magento\Authorization\Model;
77

8+
use Magento\Authorization\Model\ResourceModel\Role\Collection;
9+
use Magento\Framework\App\ObjectManager;
10+
use Magento\Framework\Model\AbstractModel;
11+
812
/**
913
* Admin Role Model
1014
*
1115
* @api
1216
* @method int getParentId()
13-
* @method \Magento\Authorization\Model\Role setParentId(int $value)
17+
* @method Role setParentId(int $value)
1418
* @method int getTreeLevel()
15-
* @method \Magento\Authorization\Model\Role setTreeLevel(int $value)
19+
* @method Role setTreeLevel(int $value)
1620
* @method int getSortOrder()
17-
* @method \Magento\Authorization\Model\Role setSortOrder(int $value)
21+
* @method Role setSortOrder(int $value)
1822
* @method string getRoleType()
19-
* @method \Magento\Authorization\Model\Role setRoleType(string $value)
23+
* @method Role setRoleType(string $value)
2024
* @method int getUserId()
21-
* @method \Magento\Authorization\Model\Role setUserId(int $value)
25+
* @method Role setUserId(int $value)
2226
* @method string getUserType()
23-
* @method \Magento\Authorization\Model\Role setUserType(string $value)
27+
* @method Role setUserType(string $value)
2428
* @method string getRoleName()
25-
* @method \Magento\Authorization\Model\Role setRoleName(string $value)
29+
* @method Role setRoleName(string $value)
2630
* @api
2731
* @since 100.0.2
2832
*/
29-
class Role extends \Magento\Framework\Model\AbstractModel
33+
class Role extends AbstractModel
3034
{
3135
/**
3236
* @var string
@@ -38,23 +42,6 @@ class Role extends \Magento\Framework\Model\AbstractModel
3842
*/
3943
protected $_cacheTag = 'user_assigned_role';
4044

41-
/**
42-
* @param \Magento\Framework\Model\Context $context
43-
* @param \Magento\Framework\Registry $registry
44-
* @param \Magento\Authorization\Model\ResourceModel\Role $resource
45-
* @param \Magento\Authorization\Model\ResourceModel\Role\Collection $resourceCollection
46-
* @param array $data
47-
*/
48-
public function __construct( //phpcs:ignore Generic.CodeAnalysis.UselessOverridingMethod
49-
\Magento\Framework\Model\Context $context,
50-
\Magento\Framework\Registry $registry,
51-
\Magento\Authorization\Model\ResourceModel\Role $resource,
52-
\Magento\Authorization\Model\ResourceModel\Role\Collection $resourceCollection,
53-
array $data = []
54-
) {
55-
parent::__construct($context, $registry, $resource, $resourceCollection, $data);
56-
}
57-
5845
/**
5946
* @inheritDoc
6047
*/
@@ -70,31 +57,30 @@ public function __sleep()
7057
public function __wakeup()
7158
{
7259
parent::__wakeup();
73-
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
74-
$this->_resource = $objectManager->get(\Magento\Authorization\Model\ResourceModel\Role::class);
75-
$this->_resourceCollection = $objectManager->get(
76-
\Magento\Authorization\Model\ResourceModel\Role\Collection::class
77-
);
60+
$objectManager = ObjectManager::getInstance();
61+
$this->_resource = $objectManager->get(ResourceModel\Role::class);
62+
$this->_resourceCollection = $objectManager->get(Collection::class);
7863
}
7964

8065
/**
81-
* Class constructor
82-
*
83-
* @return void
66+
* @inheritdoc
8467
*/
8568
protected function _construct()
8669
{
87-
$this->_init(\Magento\Authorization\Model\ResourceModel\Role::class);
70+
$this->_init(ResourceModel\Role::class);
8871
}
8972

9073
/**
91-
* Update object into database
74+
* Obsolete method of update
9275
*
9376
* @return $this
77+
* @deprecated Method was never implemented and used.
9478
*/
9579
public function update()
9680
{
97-
$this->getResource()->update($this);
81+
// phpcs:disable Magento2.Functions.DiscouragedFunction
82+
trigger_error('Method was never implemented and used.', E_USER_DEPRECATED);
83+
9884
return $this;
9985
}
10086

app/code/Magento/AwsS3/Test/Mftf/Helper/S3FileAssertions.php

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,21 @@ public function assertFileExists($filePath, $message = ''): void
149149
$this->assertTrue($this->driver->isExists($filePath), $message);
150150
}
151151

152+
/**
153+
* Asserts that a file with the given glob pattern exists in the given path on the remote storage system
154+
*
155+
* @param string $path
156+
* @param string $pattern
157+
* @param string $message
158+
*
159+
* @throws \Magento\Framework\Exception\FileSystemException
160+
*/
161+
public function assertGlobbedFileExists($path, $pattern, $message = ""): void
162+
{
163+
$files = $this->driver->search($pattern, $path);
164+
$this->assertNotEmpty($files, $message);
165+
}
166+
152167
/**
153168
* Assert a file does not exist on the remote storage system
154169
*
@@ -206,6 +221,24 @@ public function assertFileContainsString($filePath, $text, $message = ""): void
206221
$this->assertStringContainsString($text, $this->driver->fileGetContents($filePath), $message);
207222
}
208223

224+
/**
225+
* Asserts that a file with the given glob pattern at the given path on the remote storage system contains a given string
226+
*
227+
* @param string $path
228+
* @param string $pattern
229+
* @param string $text
230+
* @param int $fileIndex
231+
* @param string $message
232+
* @return void
233+
*
234+
* @throws \Magento\Framework\Exception\FileSystemException
235+
*/
236+
public function assertGlobbedFileContainsString($path, $pattern, $text, $fileIndex = 0, $message = ""): void
237+
{
238+
$files = $this->driver->search($pattern, $path);
239+
$this->assertStringContainsString($text, $this->driver->fileGetContents($files[$fileIndex] ?? ''), $message);
240+
}
241+
209242
/**
210243
* Assert a file on the remote storage system does not contain a given string
211244
*

app/code/Magento/BundleImportExport/Model/Import/Product/Type/Bundle.php

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -573,8 +573,12 @@ protected function insertOptions()
573573

574574
$optionIds = $this->connection->fetchAssoc(
575575
$this->connection->select()->from(
576-
$this->_resource->getTableName('catalog_product_bundle_option'),
576+
['bo' => $this->_resource->getTableName('catalog_product_bundle_option')],
577577
['option_id', 'position', 'parent_id']
578+
)->joinLeft(
579+
['bov' => $this->_resource->getTableName('catalog_product_bundle_option_value')],
580+
'bo.option_id = bov.option_id',
581+
['title']
578582
)->where(
579583
'parent_id IN (?)',
580584
$productIds
@@ -600,8 +604,10 @@ protected function populateInsertOptionValues(array $optionIds): array
600604
foreach ($this->_cachedOptions as $entityId => $options) {
601605
foreach ($options as $key => $option) {
602606
foreach ($optionIds as $optionId => $assoc) {
603-
if ($assoc['position'] == $this->_cachedOptions[$entityId][$key]['index']
604-
&& $assoc['parent_id'] == $entityId) {
607+
if ($assoc['position'] == $this->_cachedOptions[$entityId][$key]['index'] &&
608+
$assoc['parent_id'] == $entityId &&
609+
(empty($assoc['title']) || $assoc['title'] == $this->_cachedOptions[$entityId][$key]['name'])
610+
) {
605611
$option['parent_id'] = $entityId;
606612
$optionValues[] = $this->populateOptionValueTemplate($option, $optionId);
607613
$this->_cachedOptions[$entityId][$key]['option_id'] = $optionId;

app/code/Magento/BundleImportExport/Test/Unit/Model/Import/Product/Type/BundleTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,7 @@ public function testSaveData($skus, $bunch, $allowImport)
289289
'type' => 'bundle',
290290
'value_id' => '6',
291291
'title' => 'Bundle6',
292+
'name' => 'Bundle6',
292293
'selections' => [
293294
[
294295
'name' => 'Bundlen6',

app/code/Magento/Catalog/Block/Product/ListProduct.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -461,7 +461,7 @@ private function initializeProductCollection()
461461
// if the product is associated with any category
462462
if ($categories->count()) {
463463
// show products from this category
464-
$this->setCategoryId(current($categories->getIterator())->getId());
464+
$this->setCategoryId($categories->getIterator()->current()->getId());
465465
}
466466
}
467467

app/code/Magento/Catalog/Block/Ui/ProductViewCounter.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,7 @@ public function getCurrentProductData()
153153
$this->productRenderCollectorComposite
154154
->collect($product, $productRender);
155155
$data = $this->hydrator->extract($productRender);
156+
$data['is_available'] = $product->isAvailable();
156157

157158
$currentProductData = [
158159
'items' => [

app/code/Magento/Catalog/Controller/Adminhtml/Product/MassDelete.php

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,12 @@
99
namespace Magento\Catalog\Controller\Adminhtml\Product;
1010

1111
use Magento\Backend\App\Action\Context;
12+
use Magento\Backend\Model\View\Result\Redirect;
1213
use Magento\Catalog\Api\ProductRepositoryInterface;
14+
use Magento\Catalog\Controller\Adminhtml\Product;
1315
use Magento\Catalog\Model\ResourceModel\Product\CollectionFactory;
1416
use Magento\Framework\App\Action\HttpPostActionInterface as HttpPostActionInterface;
17+
use Magento\Framework\App\ObjectManager;
1518
use Magento\Framework\Controller\ResultFactory;
1619
use Magento\Framework\Exception\LocalizedException;
1720
use Magento\Ui\Component\MassAction\Filter;
@@ -20,7 +23,7 @@
2023
/**
2124
* Class \Magento\Catalog\Controller\Adminhtml\Product\MassDelete
2225
*/
23-
class MassDelete extends \Magento\Catalog\Controller\Adminhtml\Product implements HttpPostActionInterface
26+
class MassDelete extends Product implements HttpPostActionInterface
2427
{
2528
/**
2629
* Massactions filter
@@ -49,8 +52,8 @@ class MassDelete extends \Magento\Catalog\Controller\Adminhtml\Product implement
4952
* @param Builder $productBuilder
5053
* @param Filter $filter
5154
* @param CollectionFactory $collectionFactory
52-
* @param ProductRepositoryInterface $productRepository
53-
* @param LoggerInterface $logger
55+
* @param ProductRepositoryInterface|null $productRepository
56+
* @param LoggerInterface|null $logger
5457
*/
5558
public function __construct(
5659
Context $context,
@@ -63,20 +66,23 @@ public function __construct(
6366
$this->filter = $filter;
6467
$this->collectionFactory = $collectionFactory;
6568
$this->productRepository = $productRepository ?:
66-
\Magento\Framework\App\ObjectManager::getInstance()->create(ProductRepositoryInterface::class);
69+
ObjectManager::getInstance()->create(ProductRepositoryInterface::class);
6770
$this->logger = $logger ?:
68-
\Magento\Framework\App\ObjectManager::getInstance()->create(LoggerInterface::class);
71+
ObjectManager::getInstance()->create(LoggerInterface::class);
6972
parent::__construct($context, $productBuilder);
7073
}
7174

7275
/**
7376
* Mass Delete Action
7477
*
75-
* @return \Magento\Backend\Model\View\Result\Redirect
78+
* @return Redirect
79+
* @throws LocalizedException
7680
*/
7781
public function execute()
7882
{
7983
$collection = $this->filter->getCollection($this->collectionFactory->create());
84+
$collection->addMediaGalleryData();
85+
8086
$productDeleted = 0;
8187
$productDeletedError = 0;
8288
/** @var \Magento\Catalog\Model\Product $product */

0 commit comments

Comments
 (0)