Order/EventListener/OrderListener.php
public function handleReleasedChange(OrderInterface $order)
    {
        if ($this->persistenceHelper->isChanged($order , 'sample')) {
            if ($order->isReleased() && !$order->isSample()) {
                throw new IllegalOperationException("Can't turn 'sample' into false if order is released.");
            }
        }

        if (!$this->persistenceHelper->isChanged($order , 'released')) {
            return false;
        }

        // Orders that are not samples can't be released.
        if (!$order->isSample() && $order->isReleased()) {
            $order->setReleased(false);
            return true;
        }

        if (!OrderStates::isStockableState($order->getState())) {
            return false;
        }

        foreach ($order->getItems() as $item) {
            $this->applySaleItemRecursively($item);
        }

        return false;
    }
public function handleReleasedChange(OrderInterface $order)
    {
        if ($this->persistenceHelper->isChanged($order , 'sample')) {
            if ($order->isReleased() && !$order->isSample()) {
                throw new IllegalOperationException("Can't turn 'sample' into false if order is released.");
            }
        }

        if (!$this->persistenceHelper->isChanged($order , 'released')) {
            return false;
        }

        // Orders that are not samples can't be released.
        if (!$order->isSample() && $order->isReleased()) {
            $order->setReleased(false);
            return true;
        }

        if (!OrderStates::isStockableState($order->getState())) {
            return false;
        }

        foreach ($order->getItems() as $item) {
            $this->applySaleItemRecursively($item);
        }

        return false;
    }
public function handleReleasedChange ( OrderInterface $ order ) { if ( $ this -> persistenceHelper -> isChanged ( $ order , 'sample' ) ) { if ( $ order -> isReleased ( ) && ! $ order -> isSample ( ) ) { throw new IllegalOperationException ( "Can't turn 'sample' into false if order is released." ) ; } } if ( ! $ this -> persistenceHelper -> isChanged ( $ order , 'released' ) ) { return false ; } // Orders that are not samples can't be released. if ( ! $ order -> isSample ( ) && $ order -> isReleased ( ) ) { $ order -> setReleased ( false ) ; return true ; } if ( ! OrderStates :: isStockableState ( $ order -> getState ( ) ) ) { return false ; } foreach ( $ order -> getItems ( ) as $ item ) { $ this -> applySaleItemRecursively ( $ item ) ; } return false ; }
Handles the released flag change.

@param OrderInterface $order

@return bool
Handles the released flag change .