DoctrinePHPCRBundle
DoctrinePHPCRBundle copied to clipboard
[POC] Generate node types command
This is just a quick sketch of a command to generate CND files (just namespaces and names, no properties / children definitions).
In general binding document classes to node types will enable much more efficient filtering and selecting (e.g. SELECT * FROM MyBundle:Article WHERE title = "foobar")
Obviously there is quite a large scope here, but just to follow on from what was the issue where we discussed this?
Next steps:
- [ ] Add configuration option to automatically assign node types to documents
- [ ] Provide node type migrate command (?)
interesting, seems its not even that hard to build basic node type definitions.
i think the logic to build cnd from metadata should go into a service. configured with a map of folders to look in and name prefix to use. that logic should live in phpcr-odm, not the bundle, as its not symfony specific.
and i wonder if we should not generate one single file in the project, in the same principle as the orm doctrine:migrations:* command. depending on what i want to do, i might want the file there, or i could want it with my bundle, if the bundle is its own repository...
migration is problematic, because its not possible to delete node types or remove properties from them.
imho this is quite interesting though we then also need to work on better support for changing node types
should this go into phpcr-odm rather than the bundle?
I guess that would be the expected thing to do.