Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Observer.php
Go to the documentation of this file.
1 <?php
7 
13 class Observer
14 {
21 
27  public function __construct(
28  \Magento\Newsletter\Model\ResourceModel\Queue\CollectionFactory $queueCollectionFactory
29  ) {
30  $this->_queueCollectionFactory = $queueCollectionFactory;
31  }
32 
38  public function scheduledSend()
39  {
40  $countOfQueue = 3;
41  $countOfSubscriptions = 20;
42 
44  $collection = $this->_queueCollectionFactory->create();
45  $collection->setPageSize($countOfQueue)->setCurPage(1)->addOnlyForSendingFilter()->load();
46 
47  $collection->walk('sendPerSubscriber', [$countOfSubscriptions]);
48  }
49 }
__construct(\Magento\Newsletter\Model\ResourceModel\Queue\CollectionFactory $queueCollectionFactory)
Definition: Observer.php:27