src/Entity/StockMovement.php
protected function updateCurrency(Money $money): self
    {
        if ($this->currency && $money->getCurrency()->getCode() !== $this->currency) {
            throw new CurrencyMismatchException('The currency on this stock movement is not the same as the one your Money object');
        }

        $this->currency = $money->getCurrency()->getCode();

        return $this;
    }
protected function updateCurrency(Money $money): self
    {
        if ($this->currency && $money->getCurrency()->getCode() !== $this->currency) {
            throw new CurrencyMismatchException('The currency on this stock movement is not the same as the one your Money object');
        }

        $this->currency = $money->getCurrency()->getCode();

        return $this;
    }
protected function updateCurrency ( Money $ money ) : self { if ( $ this -> currency && $ money -> getCurrency ( ) -> getCode ( ) !== $ this -> currency ) { throw new CurrencyMismatchException ( 'The currency on this stock movement is not the same as the one your Money object' ) ; } $ this -> currency = $ money -> getCurrency ( ) -> getCode ( ) ; return $ this ; }
Updates the shared currency.

If the currency is already set and the new currency is not the same, it throws an exception

@param Money $money

@return StockMovement

@throws \Loevgaard\DandomainStock\Exception\CurrencyMismatchException
Updates the shared currency .