Question: We have an "Yes/No" product attribute and we need this information on product image renderer.
So I have overrided the ImageFactory.php with di preference.

The code looks like that:

```
private function isAttribute(Product $product): bool
{
    if ($product->getAttributeText('attribute_value') == 'Yes') {
        return true;
    }
    return false;
}

```

The result is always false on cart page. This code works on all places like the product details page but not on the cart page! Why?

I have cleaned all caches of corse. Thanks in advance.

Answer: 
As I didn't want to use direct SQL I ended up creating a collection and then looping through and deleting:

```
$myCollection = $this->myCollectionFactory->create()
    ->addFieldToFilter('attr1', array('eq'=> 'aaa')
    ->addFieldToFilter('attr2', array('eq'=> 'bbb'))
    ->addFieldToFilter('attr3', array('eq'=> 'ccc'));

$myModelFactory = $this->myModelFactory->create();
foreach ($myCollection as $myModel) {
    $myModelFactory->load($myModel->getId());
    $myModelFactory->delete();
}

```

Not sure if this is the correct way but it works. Thanks.
```
           $customModel= $this->customModel->create();
            $customModelClone = $customModel->getCollection()->addFieldToSelect('*')
                ->addFieldToFilter('coupon_code',['like' => "$othervar%"]);

            if ($sku == null) {
                $customModelClone;
            } else {
                $customModelClone->addFieldToFilter('sku',['eq' => $sku]);
            }

            if ($customModelClone->getSize() > 0) {
                foreach ($customModelClone  as $custom) {
                    $custom->delete();
                }
            }

```

for me in magento 2.4.3 use `Company\CustomModule\Model\ModelFactory`, if use `load()` it will fail, but if you not use `load()` and foreach after `addFieldToFilter()` it will be successfully removed (able to multiple data)

I hope this helps