i just try to call save method on collection function like bellow code
class Index extends \Magento\Framework\App\Action\Action
{
protected $resultPageFactory;
private $product;
/**
* Constructor
*
* @param \Magento\Framework\App\Action\Context $context
* @param \Magento\Framework\View\Result\PageFactory $resultPageFactory
*/
public function __construct(
\Magento\Framework\App\Action\Context $context
\Magento\Catalog\Model\Product $product,
\Magento\Framework\View\Result\PageFactory $resultPageFactory
) {
$this->resultPageFactory = $resultPageFactory;
$this->product=$product;
parent::__construct($context);
}
/**
* Execute view action
*
* @return \Magento\Framework\Controller\ResultInterface
*/
public function execute()
{
$collection = $this->product->getCollection();
var_dump($collection->save());exit;
}
}
it not show any error just go in infinite loop .... no any error.
My Question is what actually happen it save all product or any error ?