Open michnovka opened 2 weeks ago
Sounds interesting indeed. TIL about the type field mappers, thanks 👌🏻
We have to agree what to do with the yaml config, especially if we have conflicts. Will one take precedence? Will we throw?
Usually, YAML config wins over PHP attributes. It is meant to allow overriding the config per Symfony env easily. Despite I don't see much use-case for it, I guess we should stick to the convention here.
I have a proposal: right now we require to list manually all types that we want to integrate with doctrine inside
elao_enum.yaml
file.Let's introduce a new attribute
Elao\Attribute\DBALType
.We can take advantage of autoconfiguration:
then its easy to find inside
CompilerPass
I just think this is more flexible approach than always remembering to add a config type to yaml config.
And, as an added benefit, because of the reflection used in PHP code, this allows us to use
TypedFieldMapper
to map all such enums to their types. So we can then useinstead of
WDYT?
We have to agree what to do with the yaml config, especially if we have conflicts. Will one take precedence? Will we throw?