$entityManager->
persist($product);
} } /**
* Helper function to check if the stock is valid if the article is on sale
*/
private function isValidStock(ProductVariant
$variant, int
$newStock): bool
{ if ($newStock < 0 &&
$variant->
getLastStock()) { return false;
} return true;
} /**
* Checks if the order position is a regular product
*/
private function isProductPosition(Detail
$orderDetailModel): bool
{