src/Entity/Product.php
protected function findPrice(PriceInterface $searchPrice): ?PriceInterface
    {
        foreach ($this->prices as $price) {
            if ($price->getAmount() == $searchPrice->getAmount() && $price->getB2bGroupId() == $searchPrice->getB2bGroupId() && $price->getCurrency()->getId() == $searchPrice->getCurrency()->getId()) {
                return $price;
            }
        }

        return null;
    }
protected function findPrice(PriceInterface $searchPrice): ?PriceInterface
    {
        foreach ($this->prices as $price) {
            if ($price->getAmount() == $searchPrice->getAmount() && $price->getB2bGroupId() == $searchPrice->getB2bGroupId() && $price->getCurrency()->getId() == $searchPrice->getCurrency()->getId()) {
                return $price;
            }
        }

        return null;
    }
protected function findPrice ( PriceInterface $ searchPrice ) : ? PriceInterface { foreach ( $ this -> prices as $ price ) { if ( $ price -> getAmount ( ) == $ searchPrice -> getAmount ( ) && $ price -> getB2bGroupId ( ) == $ searchPrice -> getB2bGroupId ( ) && $ price -> getCurrency ( ) -> getId ( ) == $ searchPrice -> getCurrency ( ) -> getId ( ) ) { return $ price ; } } return null ; }
This method will try to find a price based on the unique constraint defined in price.

@param PriceInterface $searchPrice

@return PriceInterface|null
This method will try to find a price based on the unique constraint defined in price .