mapper-php icon indicating copy to clipboard operation
mapper-php copied to clipboard

How to interact with the data that is going to be mapped.

Open ovflowd opened this issue 7 years ago • 0 comments

What I mean is the following:

  1. Suppose I have a scenario with a Model called Data with these two attributes: serviceId and values
  2. I need first check if the serviceId is valid with the Rule pattern, if is, the mapping continues.
  3. After that I retrieve the parameters from that Service by the serviceId (parameters is a property from the Service Model).
  4. I rearrange/sort the values property from the Data model that is being mapped, according to the parameters from the Service model that is stored in the database.

How could I do the item 4? With cweiske/jsonmapper I was only doing setters in order of achieve that.

Does this library also uses setters in order to set a custom mapped data with the input data?

Or could I use the Rule pattern? or does there exists another pattern? Thanks!

ovflowd avatar May 13 '18 15:05 ovflowd