brick / money

A money and currency library for PHP
MIT License
1.61k stars 96 forks source link

Add CustomContext::getScale() #13

Closed jiripudil closed 6 years ago

jiripudil commented 6 years ago

The motivation behind this is to be able to serialize the Money object and its context and later recreate it to the original version without losing information. We're using our own serialization code and we have a lot of Monies here and there being serialized and unserialized, so we'd like to avoid using reflection.

This is just an initial kick off, I'm looking forward to hearing your thoughts on this.

jkuchar commented 6 years ago

Currently, it is possible to retrieve scale using Money::getScale(), this forces us to serialise money and context together. Adding getScale() makes contexts independently serializable, which makes sense to me.

BenMorel commented 6 years ago

Thanks, released as 0.2.1.