$product->
setInStock($product->
getInStock() +
$detail->
getQuantity());
$this->entityManager->
persist($product);
} } /**
* Returns the product of the product position
*/
protected function getProductFromDetail(OrderDetail
$detail): ?ProductDetail
{ if (\
in_array($detail->
getMode(),
[0, 1
], true
)) { if ($detail->
getArticleDetail() &&
$detail->
getArticleDetail()->
getId()) { // After the detail got removed, the association to the product detail does not exist anymore.
return $detail->
getArticleDetail();
} elseif ($detail->
getArticleNumber()) { return $this->
getProductByNumber($detail->
getArticleNumber());
} } return null;
} /**
* Returns a product by the ordernumber
*/