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;
        }
    }
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;
        }
    }
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 ; } }
returns sum of items that are assigned to a shipping which is not in status 'created'
@param $orderId
@param $includeStatusDeliveryNote defines if status deliveryNote should be included
@return array|null
returns sum of items that are assigned to a shipping which is not in status created