Files
Ihor Sviziev a2b9380986 Use one format in all places for array_merge
Fix potential issues when no items in array
Convert all array_merge into single format
2020-09-23 09:17:20 +03:00

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));
}
}