mirror of
https://github.com/bdnugget/magento2.git
synced 2026-11-08 01:37:36 +00:00
Fix potential issues when no items in array Convert all array_merge into single format
48 lines
1.1 KiB
PHP
48 lines
1.1 KiB
PHP
<?php
|
|
/**
|
|
* Copyright © Magento, Inc. All rights reserved.
|
|
* See COPYING.txt for license details.
|
|
*/
|
|
|
|
namespace Magento\Sales\Model\ResourceModel\Provider;
|
|
|
|
use Magento\Framework\ObjectManager\TMapFactory;
|
|
|
|
/**
|
|
* Implements NotSyncedDataProviderInterface as composite
|
|
*/
|
|
class NotSyncedDataProvider implements NotSyncedDataProviderInterface
|
|
{
|
|
/**
|
|
* @var NotSyncedDataProviderInterface[]
|
|
*/
|
|
private $providers;
|
|
|
|
/**
|
|
* @param TMapFactory $tmapFactory
|
|
* @param array $providers
|
|
*/
|
|
public function __construct(TMapFactory $tmapFactory, array $providers = [])
|
|
{
|
|
$this->providers = $tmapFactory->create(
|
|
[
|
|
'array' => $providers,
|
|
'type' => NotSyncedDataProviderInterface::class
|
|
]
|
|
);
|
|
}
|
|
|
|
/**
|
|
* @inheritDoc
|
|
*/
|
|
public function getIds($mainTableName, $gridTableName)
|
|
{
|
|
$result = [];
|
|
foreach ($this->providers as $provider) {
|
|
$result[] = $provider->getIds($mainTableName, $gridTableName);
|
|
}
|
|
|
|
return array_unique(array_merge([], ...$result));
|
|
}
|
|
}
|