-
Notifications
You must be signed in to change notification settings - Fork 330
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[RFC] Do not force to use annotations for Sylius project #335
base: 1.12
Are you sure you want to change the base?
Conversation
0b0231f
to
c1dd292
Compare
c1dd292
to
099937e
Compare
099937e
to
49f6321
Compare
@@ -19,6 +19,90 @@ doctrine: | |||
App: | |||
is_bundle: false | |||
type: annotation | |||
dir: '%kernel.project_dir%/src/Entity' | |||
prefix: 'App\Entity' | |||
dir: '%kernel.project_dir%/src/Entity/Main' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Better names: App
, Custom
, Application
Regarding the actual problem I always use XML in bundles/plugins (which I make a lot of :D) so I am also a big fan of XML, but I am also a big fan of annotations within applications. It's very easy to read, and if I want to use third party plugins they will usually provide an annotated trait, which also makes it very easy. But I don't see anything wrong with this PR. It gives the flexibility you are looking for at least :) |
@Zales0123 Could you decide to kill or make this feature work? It's been 3 years and I don't see much activity here 😄 |
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 🖖 ☮️