How to Create product collection with filter based on entity_id in Magento 2?
I tried below:
$model = $this->_objectManager->create('Vendor\MOdule\Model\Queue');
$ProductId = $this->skuProcessor->getNewSku($rowSku)['entity_id'];
$getId = $tagmodel->getCollection()
->addFieldToFilter('entity_id', $ProductId);
// Tried this too
/*
$getId=$model->getCollection()->create()
->addAttributeToSelect('*')
->addFieldToFilter('entity_id',$ProductId); */
if ($getId = '') {
$tagmodel->setEntityId($ProductId);
$tagmodel->save();
}
I am not getting the collection! nor the id is saved
My id should no be saved if already present in DB.