<?php
namespace FiloBlu\Channel\Controller\Adminhtml\Channel;
/**
 * Class MassMeta
 * @package FiloBlu\Channel\Controller\Adminhtml\Channel
 */
class MassMeta extends \Magento\Backend\App\Action
{
    /**
     * @var \Magento\Framework\View\Result\PageFactory
     */
    public function execute()
    {
		 $ids = $this->getRequest()->getParam('id');
		 $status = $this->getRequest()->getParam('status');
         $flow = urldecode($this->getRequest()->getParam('flow'));
		if (!is_array($ids) || empty($ids)) {
            $this->messageManager->addError(__('Please select product(s).'));
        } else {
            try {
                foreach ($ids as $id) {
                    $row = $this->_objectManager->get('FiloBlu\Flow\Model\Channel' . "\\" . $flow)->load($id);
					$row->setData('meta_processed',$status)
							->save();
				}
                $this->messageManager->addSuccess(
                    __('A total of %1 record(s) have been deleted.', count($ids))
                );
            } catch (\Exception $e) {
                $this->messageManager->addError($e->getMessage());
            }
        }
		//$this->_redirect('*/*/');
    }
}
