mardi 8 décembre 2020

how to map domain enitty and related VO's to ORM (dcotrine) entity without getters?

I'm trying to make an application as clean as possible (in my opinion). A bit description of architecture before the actual issue I want to solve. I'm using onion architecture, so my core (domain and application layer) do not know about other external layers (presentation, infrastructure).

Because of the onion architecture, I do not want to add doctrine annotation to domain entities to keep the domain framework agnostic, also I can't use yaml mapping b-z my domain entities do not match doctrine entities. So it seems I need to make some mapping functionality to convert domain entities to the doctrine entities. But here also one more rule I'm trying to follow, the rule is avoid using getters/setters. So the question is how can make those mappers without using getters/setters, should I use reflection (I'm not fun of this approach either)? Is there any other possible solution, patterns?

Thanks in advance!

Also, I start thinking do I even need ORM? :) Anyway, I'm trying to make my own mapper

Aucun commentaire:

Enregistrer un commentaire