26 lines
644 B
PHP
26 lines
644 B
PHP
<?php
|
|
|
|
namespace Stemcell\Customer\Ui\Component\DataProvider;
|
|
|
|
use Magento\Framework\Data\OptionSourceInterface;
|
|
use Stemcell\Customer\Model\ResourceModel\Salesperson\Collection;
|
|
|
|
class SalespersonOption implements OptionSourceInterface
|
|
{
|
|
private Collection $collection;
|
|
|
|
public function __construct(
|
|
Collection $collection
|
|
) {
|
|
$this->collection = $collection;
|
|
}
|
|
|
|
public function toOptionArray()
|
|
{
|
|
return $this->collection->addFieldToFilter('is_active', 1)
|
|
->addFieldToSelect('salesperson_id', 'value')
|
|
->addFieldToSelect('name', 'label')
|
|
->getData();
|
|
}
|
|
}
|