Skip to content
This repository has been archived by the owner on Sep 16, 2021. It is now read-only.

[2.0] Usage without Doctrine ODM #145

Open
iluuu1994 opened this issue Mar 31, 2017 · 3 comments
Open

[2.0] Usage without Doctrine ODM #145

iluuu1994 opened this issue Mar 31, 2017 · 3 comments

Comments

@iluuu1994
Copy link

We're using Gedmo Tree instead of Doctrine ODM for our tree data structure. In Version 1.0 of the TreeBrowserBundle it was pretty easy to write my own Tree class by implementing the TreeInterface.

How can I achieve the same thing now?

Thanks for your work!

@wouterj
Copy link
Member

wouterj commented Apr 7, 2017

@iluuu1994 now, the resource packages are used for the backend. Resource is an abstraction of tree-based backends, built on top of Puli.

So to make this Gedmo Tree compatible, you have to create a GedmoTreeRepository. You can see the DoctrineOdm repository here: https://github.com/symfony-cmf/resource/blob/master/src/Repository/PhpcrOdmRepository.php

After that, you have to create a GedmoTreeRepositoryFactory for the interaction with the container: https://github.com/symfony-cmf/resource-bundle/blob/master/src/DependencyInjection/Repository/Factory/DoctrinePhpcrOdmFactory.php

Then in your bundle's build() method, add CmfResourceBundle::addRepositoryFactory(new GedmoTreeRepositoryFactory()); and enable the factory like: https://github.com/symfony-cmf/cmf-sandbox/blob/master/app/config/config.yml#L121-L123

So it involves some more things, but the good side of the story is that you have a nice abstraction for the tree that you can use throughout your application (so it's easy to switch to PHPCR ODM, file structure, XML, any tree like thing in the future for instance).

@iluuu1994
Copy link
Author

@wouterj Thanks for the thorough explanation! I'll let you know if I get it working. Would you be interested in merging the Gedmo adapter?

@wouterj
Copy link
Member

wouterj commented Apr 8, 2017

Yep, I'm very interesting in supporting ORM in the Symfony CMF. Adding a Gedmo tree repository seems like a very nice step in this direction.

If you need any help creating the repository or pull request, feel free to join the #symfony_cmf channel on the Symfony slack and ping me (@wouterj).

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants