Hi Benjamin,
First of all, thank you very much for your work on this tough issue.
On 12/8/10 11:21 PM, Benjamin Eberlei wrote:
Hello everyone,
We discussed the Mapping configuration of the Doctrine bundles in our last IRC
meeting and I had the time to investigate possible changes tonight. @Fabien: I
know you want the autodetection in to simplify usage for starters, but there
are very real drawbacks about it. I present the problems and a very good
solution (that will not even complicate usage for starters).
I don't really "want" auto-detection. I just want something simple for
newcomers: "Be as simple as possible for newcomers, but as flexible as
possible for advanced users". Right now, we are probably 'too' simple
for newcomers and very inflexible for advanced users.
Solution:
1. Be explicit! At the minimum you have to configure which bundle uses which
ORM/ODM. See a cascading example of the possible configuration complexities:
doctrine.orm:
default:
bundles:
bundleName1: ~
bundleName2: yml
bundleName3: { type: annotation, dir: Entities/ }
bundleName4: { type: xml, dir: Resources/config/doctrine/mapping }
bundleName5: { type: yml, dir: doctrine/metadata }
bundleName6:
type: yml
dir: [bundle-mappings1/, bundle-mappings2/]
bundleName7:
type: my-driver-service
That's very similar to how the routing configuration works. Routes from
bundles are never automatically registered. You need to explicitly
include them in your main routing configuration. So, I like your
solution a lot. It makes a lot of sense.
One thing I also want to fix, and I'm not sure if your solution can
solve it as is, is when the model classes are defined *outside* of the
bundle hierarchy. One goal of the "Model" is to be reusable. So, you
should be able to reuse your entities in a non-Symfony2 context. Right
now, you are forced to define them in a bundle, which is tied to
Symfony2 obviously (even if this is just a bunch of directories that
define a namespace hierarchy).
To sum up, I'm +1 on the change. If we can also find a solution for
"non-bundled" entities, that would even be better.
Fabien
--
If you want to report a vulnerability issue on symfony, please send it to
security at symfony-project.com
You received this message because you are subscribed to the Google
Groups "symfony developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/symfony-devs?hl=en