示例#1
0
文件: Grid.php 项目: aiesh/magento2
 /**
  * @return $this
  */
 protected function _prepareCollection()
 {
     /** @var $collection \Magento\Newsletter\Model\Resource\Queue\Collection */
     $collection = $this->_collectionFactory->create()->addTemplateInfo()->addSubscriberFilter($this->_coreRegistry->registry('subscriber')->getId());
     $this->setCollection($collection);
     return parent::_prepareCollection();
 }
示例#2
0
 /**
  * Return queue collection with loaded neversent queues
  *
  * @return Collection
  */
 public function getQueueCollection()
 {
     if (is_null($this->_queueCollection)) {
         /** @var $this->_queueCollection \Magento\Newsletter\Model\Resource\Queue\Collection */
         $this->_queueCollection = $this->_collectionFactory->create()->addTemplateInfo()->addOnlyUnsentFilter()->load();
     }
     return $this->_queueCollection;
 }
示例#3
0
 /**
  * Scheduled send handler
  *
  * @param Schedule $schedule
  * @return void
  * @SuppressWarnings(PHPMD.UnusedFormalParameter)
  */
 public function scheduledSend($schedule)
 {
     $countOfQueue = 3;
     $countOfSubscriptions = 20;
     /** @var \Magento\Newsletter\Model\Resource\Queue\Collection $collection */
     $collection = $this->_queueCollectionFactory->create();
     $collection->setPageSize($countOfQueue)->setCurPage(1)->addOnlyForSendingFilter()->load();
     $collection->walk('sendPerSubscriber', [$countOfSubscriptions]);
 }