public function addPayment(Payment $payment)
    {
        if ($payment->getPaymentInstruction() !== $this) {
            throw new \InvalidArgumentException('This payment container belongs to another instruction.');
        }

        $this->payments->add($payment);
    }
public function addPayment(Payment $payment)
    {
        if ($payment->getPaymentInstruction() !== $this) {
            throw new \InvalidArgumentException('This payment container belongs to another instruction.');
        }

        $this->payments->add($payment);
    }
public function addPayment ( Payment $ payment ) { if ( $ payment -> getPaymentInstruction ( ) !== $ this ) { throw new \ InvalidArgumentException ( 'This payment container belongs to another instruction.' ) ; } $ this -> payments -> add ( $ payment ) ; }
This method adds a Payment container to this PaymentInstruction.

This method is called automatically from Payment::__construct().

@param Payment $payment
This method adds a Payment container to this PaymentInstruction .