[RFC] Do not force to use annotations for Sylius project #335
+86
−2
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I open this PR as a base for a discussion about default orm mapping in Sylius-Standard.
Right now we have all Sylius entities extended by default in
src/Entity/
directory and mapped with annotations mapping - which is correct and useful, as we have no better option to extend Sylius entities in plugins than providing a trait with new properties, including their mapping. So with such a configuration installing a plugin and extending a Sylius entity is quite hassle-free.HOWEVER
I, personally, feel bad that I'm a little bit forced to use annotations (I really prefer
yml
or, even better,xml
mapping). I know, I'm not the only one, even though there are not so many of us nowadays 🏝 👴 When I create my own, new resource, insrc/Entity/
directory, I'm not able to change the mapping type that I hate, without changing it for all other entities. I was struggling with this issue, as I don't want to force anyone to follow my rules, but on the other hand, I don't want to be forced to anything neither 🚀 Moreover, a doctrine mapping configuration is not so smart and we cannot define any rule like "use this mapping or, if it's not defined, use this instead" 😢 The only way to differentiate mappings is to separate entities into subdirectories and configure mapping for them.As a first proposal, I wanted to move all Sylius entities to
src/Entity/Sylius
and create anothersrc/Entity/Main
directory with different configurations. I found it kinda weird, so I propose a separate configuration for each pack of entities and another one for asrc/Entity/Main
(name to be refactored), as a directory for custom entities.I don't know is it the best solution. More, I don't even know if maybe it's my imagined problem 😄 But I would love to see an opinion of others @Sylius/core-team members and, of course, from our beloved community 🎉
Live long and prosper 🖖 ☮️