Common/EventListener/AbstractAdjustmentListener.php
protected function getSaleFromItem(Model\SaleItemInterface $item)
    {
        if (null !== $sale = $item->getSale()) {
            return $sale;
        }

        $path = $this->getSalePropertyPath();
        $cs = $this->persistenceHelper->getChangeSet($item);

        if (isset($cs[$path])) {
            return $cs[$path][0];
        } elseif (null !== $parent = $item->getParent()) {
            return $this->getSaleFromItem($parent);
        } elseif (isset($cs['parent'])) {
            return $this->getSaleFromItem($cs['parent'][0]);
        }

        return null;
    }
protected function getSaleFromItem(Model\SaleItemInterface $item)
    {
        if (null !== $sale = $item->getSale()) {
            return $sale;
        }

        $path = $this->getSalePropertyPath();
        $cs = $this->persistenceHelper->getChangeSet($item);

        if (isset($cs[$path])) {
            return $cs[$path][0];
        } elseif (null !== $parent = $item->getParent()) {
            return $this->getSaleFromItem($parent);
        } elseif (isset($cs['parent'])) {
            return $this->getSaleFromItem($cs['parent'][0]);
        }

        return null;
    }
protected function getSaleFromItem ( Model \ SaleItemInterface $ item ) { if ( null !== $ sale = $ item -> getSale ( ) ) { return $ sale ; } $ path = $ this -> getSalePropertyPath ( ) ; $ cs = $ this -> persistenceHelper -> getChangeSet ( $ item ) ; if ( isset ( $ cs [ $ path ] ) ) { return $ cs [ $ path ] [ 0 ] ; } elseif ( null !== $ parent = $ item -> getParent ( ) ) { return $ this -> getSaleFromItem ( $ parent ) ; } elseif ( isset ( $ cs [ 'parent' ] ) ) { return $ this -> getSaleFromItem ( $ cs [ 'parent' ] [ 0 ] ) ; } return null ; }
Returns the sale from the given sale item (looking into change set).

@param Model\SaleItemInterface $item

@return Model\SaleInterface|null
Returns the sale from the given sale item ( looking into change set ) .