dddshelf / ddd-in-php-book-issues

Leave your comments, improvements or book mistakes as an issue! Thanks ❤️
https://leanpub.com/ddd-in-php
28 stars 2 forks source link

Small detail in Money equals method #87

Closed JPuigV closed 6 years ago

JPuigV commented 6 years ago

On page 79, the method that checks the equality of the current Money object with another one, is calling the equals method on its Currency VO, but passing the own Currency object instead the one from the Money object which is comparing with.

So from line 49: public function equals(Money $aMoney) { return $this->amount() === $aMoney->amount() && $this->currency()->equals($this->currency()); } Should be changed by: public function equals(Money $aMoney) { return $this->amount() === $aMoney->amount() && $this->currency()->equals($aMoney->currency()); }

keyvanakbary commented 6 years ago

Thanks Jordi! We fixed it and it should be online already. Thanks a lot for your help 🤗