public function onPostCopy(SaleTransformEvent $event)
    {
        $source = $event->getSource();
        $target = $event->getTarget();

        // Origin number
        $target->setOriginNumber($source->getNumber());

        // Sample
        if ($source instanceof OrderInterface && $target instanceof OrderInterface) {
            $target->setSample($source->isSample());
        }

        // Abort if source sale has no customer
        if (null === $customer = $source->getCustomer()) {
            return;
        }

        // If target sale is order and source customer has parent
        if ($target instanceof OrderInterface && $customer->hasParent()) {
            // TODO Duplicate code
            /** @see \Ekyna\Component\Commerce\Order\EventListener\OrderListener::fixCustomers() */

            // Sets the parent as customer
            $target->setCustomer($customer->getParent());

            // Sets the origin customer
            if (null === $target->getOriginCustomer()) {
                $target->setOriginCustomer($customer);
            }
        }
    }
public function onPostCopy(SaleTransformEvent $event)
    {
        $source = $event->getSource();
        $target = $event->getTarget();

        // Origin number
        $target->setOriginNumber($source->getNumber());

        // Sample
        if ($source instanceof OrderInterface && $target instanceof OrderInterface) {
            $target->setSample($source->isSample());
        }

        // Abort if source sale has no customer
        if (null === $customer = $source->getCustomer()) {
            return;
        }

        // If target sale is order and source customer has parent
        if ($target instanceof OrderInterface && $customer->hasParent()) {
            // TODO Duplicate code
            /** @see \Ekyna\Component\Commerce\Order\EventListener\OrderListener::fixCustomers() */

            // Sets the parent as customer
            $target->setCustomer($customer->getParent());

            // Sets the origin customer
            if (null === $target->getOriginCustomer()) {
                $target->setOriginCustomer($customer);
            }
        }
    }
public function onPostCopy ( SaleTransformEvent $ event ) { $ source = $ event -> getSource ( ) ; $ target = $ event -> getTarget ( ) ; // Origin number $ target -> setOriginNumber ( $ source -> getNumber ( ) ) ; // Sample if ( $ source instanceof OrderInterface && $ target instanceof OrderInterface ) { $ target -> setSample ( $ source -> isSample ( ) ) ; } // Abort if source sale has no customer if ( null === $ customer = $ source -> getCustomer ( ) ) { return ; } // If target sale is order and source customer has parent if ( $ target instanceof OrderInterface && $ customer -> hasParent ( ) ) { // TODO Duplicate code /** @see \Ekyna\Component\Commerce\Order\EventListener\OrderListener::fixCustomers() */ // Sets the parent as customer $ target -> setCustomer ( $ customer -> getParent ( ) ) ; // Sets the origin customer if ( null === $ target -> getOriginCustomer ( ) ) { $ target -> setOriginCustomer ( $ customer ) ; } } }
Post copy event handler.

@param SaleTransformEvent $event
Post copy event handler .