neo4j-php / neo4j-symfony

Symfony Bundle for the Neo4j Graph Database
MIT License
78 stars 41 forks source link

Allow custom mapping configuration like in Doctrine Bundle #46

Open tbureck opened 6 years ago

tbureck commented 6 years ago

Currently, when you use neo4j-bundle you can only use annotation mapping because it's the EntityManager's default way to load mapping information. As XML mapping is basically possible, I think this bundle should support defining custom mapping information as well.

So I'd like to suggest this feature, which would enable to configure the mapping information via the configuration file, just like Doctrine does it. In doctrine-bundle you can specify the mappings to be used by an entity manager, by specifying them in the configuration like this:

doctrine:
  orm:
    entity_managers:
      default:
        [...]
        mappings:
          mapping_name:
            mapping:              true
            type:                 ~
            dir:                  ~
            alias:                ~
            prefix:               ~
            is_bundle:            ~

My suggestion is to implement the same structure to neo4j-bundle. Omitting the mappings configuration should lead to using annotations, just like before, in order to keep BC.

Notice: @ikwattro mentioned, XML mapping might need some updating on graphaware/neo4j-php-ogm's side.