estratocloud / edifact

Parser and Serializer for UN/EDIFACT messages in PHP
Apache License 2.0
35 stars 9 forks source link

Allow to inject serializer into message #12

Closed mkurzeja closed 7 months ago

mkurzeja commented 3 years ago

Moved serializer to constructor in order to allow to override it.

This allows to inject a custom serializer instance, with f.e. configured different characters.

In my case I needed to use '.' as a decimal separator, it is not possible without the above change (or skipping the message->serialize method).

duncan3dc commented 8 months ago

Hi @mkurzeja , sorry for the delay here.

The Message#serialize() method is only really a helper for using the default settings, which is why there's no support for overriding them.

I suppose there's no harm in adding this, however could you do it as an argument to the serialize() method instead of creating a new property? That makes more sense to me, thanks

mkurzeja commented 7 months ago

Hi @duncan3dc

I'm unfortunately no longer in the project that was using your library, and have currently no good way to change/test that.

The project runs on the fork I've created with this one change.

duncan3dc commented 7 months ago

No problem, thanks for getting back to me, happy coding!