49 private $identityContainer;
54 private $storeManager;
79 ->get(\
Magento\Sales\Model\
Order\Email\Container\NullIdentity::class);
81 ->get(\
Magento\Store\Model\StoreManagerInterface::class);
88 public function sendEmails()
90 if ($this->globalConfig->getValue(
'sales_email/general/async_sending')) {
91 $this->entityCollection->addFieldToFilter(
'send_email', [
'eq' => 1]);
92 $this->entityCollection->addFieldToFilter(
'email_sent', [
'null' =>
true]);
93 $this->entityCollection->setPageSize(
94 $this->globalConfig->getValue(
'sales_email/general/sending_limit')
98 $stores = $this->getStores(clone $this->entityCollection);
102 $this->identityContainer->setStore(
$store);
103 if (!$this->identityContainer->isEnabled()) {
111 if ($this->emailSender->send(
$item,
true)) {
112 $this->entityResource->save(
113 $item->setEmailSent(
true)
128 private function getStores(
133 $entityCollection->addAttributeToSelect(
'store_id')->getSelect()->group(
'store_id');
137 $store = $this->storeManager->getStore(
$item->getStoreId());
__construct(\Magento\Sales\Model\Order\Email\Sender $emailSender, \Magento\Sales\Model\ResourceModel\EntityAbstract $entityResource, \Magento\Sales\Model\ResourceModel\Collection\AbstractCollection $entityCollection, \Magento\Framework\App\Config\ScopeConfigInterface $globalConfig, IdentityInterface $identityContainer=null, \Magento\Store\Model\StoreManagerInterface $storeManager=null)