public function getSumOfShippedItemsByOrderId($orderId, $includeStatusDeliveryNote)
    {
        try {
            $qb = $this->createQueryBuilder('shipping')
                ->select('partial shipping.{id}, partial items.{id}, sum(shippingItems.quantity) AS shipped')
                ->leftJoin('shipping.order', 'o', 'WITH', 'o.id = :orderId')
                ->join('o.items', 'items')
                ->join('shipping.status', 'status')
                ->leftJoin('shipping.shippingItems', 'shippingItems', 'WITH', 'items = shippingItems.item')
                ->setParameter('orderId', $orderId)
                ->groupBy('items.id')
                ->where('status.id = :statusId')
                ->setParameter('statusId', ShippingStatus::STATUS_SHIPPED);
            if ($includeStatusDeliveryNote) {
                $qb->orWhere('status.id = :statusId2')
                    ->setParameter('statusId2', ShippingStatus::STATUS_DELIVERY_NOTE);
            }
            return $qb->getQuery()->getScalarResult();
        } catch (NoResultException $exc) {
            return null;
        }
    }