This commit is contained in:
2026-09-15 10:26:34 +08:00
commit ecf36afa56
10493 changed files with 1404888 additions and 0 deletions
@@ -0,0 +1,39 @@
<?php
namespace Stemcell\Customer\Ui\Component\DataProvider;
use Magento\Framework\Data\OptionSourceInterface;
use Magento\Customer\Model\ResourceModel\Customer\Collection;
class VendorOption implements OptionSourceInterface
{
private Collection $collection;
/**
* @var array
*/
protected array $customerTree;
public function __construct(
Collection $collection
) {
$this->collection = $collection;
}
public function toOptionArray()
{
$collection = $this->collection->addFieldToSelect('firstname');
foreach ($collection as $customer) {
$customerId = $customer->getEntityId();
if (!isset($customerById[$customerId])) {
$customerById[$customerId] = [
'value' => $customerId
];
}
$customerById[$customerId]['label'] = $customer->getFirstname();
}
$this->customerTree = $customerById;
return $this->customerTree;
}
}