->
from(Voucher::
class, 'voucher'
) ->
leftJoin('voucher.codes', 'voucherCodes'
) ->
where('voucher.modus = 1'
) ->
andWhere('voucher.id = :voucherId'
) ->
andWhere('voucher.validTo >= CURRENT_DATE() OR voucher.validTo is NULL'
) ->
andWhere('voucherCodes.customerId is NULL'
) ->
andWhere('voucherCodes.cashed = 0'
) ->
setParameter('voucherId',
$voucherId) ->
setMaxResults(1
) ->
getQuery() ->
getOneOrNullResult(AbstractQuery::HYDRATE_ARRAY
);
} /**
* @return ProductVariant[]
*/
private function getOutOfStockProducts(Order
$order): array
{ $products =
$this->
getProductsOfOrder($order);
$invalid =
[];
foreach ($products as $product) {