Ejemplo n.º 1
0
 /**
  * Joined collection
  * @return array
  */
 public function getQuestionCollection()
 {
     if ($this->isEnabled()) {
         $collection = $this->questionColFactory->create();
         $questionCollection = $collection->joinedCollection($this->getProductId());
         return $questionCollection;
     }
 }
Ejemplo n.º 2
0
 /**
  * Execute action
  *
  * @return \Magento\Backend\Model\View\Result\Redirect
  * @throws \Magento\Framework\Exception\LocalizedException|\Exception
  */
 public function execute()
 {
     $collection = $this->filter->getCollection($this->collectionFactory->create());
     foreach ($collection as $item) {
         $item->setStatus(true);
         $item->save();
     }
     $this->messageManager->addSuccess(__('A total of %1 record(s) have been enabled.', $collection->getSize()));
     /** @var \Magento\Backend\Model\View\Result\Redirect $resultRedirect */
     $resultRedirect = $this->resultFactory->create(ResultFactory::TYPE_REDIRECT);
     return $resultRedirect->setPath('*/*/');
 }
Ejemplo n.º 3
0
 /**
  * Prepare collection
  *
  * @return \Magento\Backend\Block\Widget\Grid\Extended
  */
 protected function _prepareCollection()
 {
     $collection = $this->questionColFactory->create();
     $this->setCollection($collection);
     return parent::_prepareCollection();
 }