Skip to content

can we refactor RaindropRoutingBundle into this bundle to get ORM routes? #83

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

Closed
dbu opened this issue Apr 26, 2013 · 6 comments
Closed

Comments

@dbu
Copy link
Member

dbu commented Apr 26, 2013

i stumbled over https://github.com/raindropdevs/RaindropRoutingBundle which is built on this bundle, but providing ORM stuff for the routing. at least the generic orm routing would be very cool to have in the cmf bundle directly.

i don't know yet if there are things in that bundle that go beyond what the cmf routing bundle can do - we should check and decide if everything is of general use or not.

/cc @erivello @matteocaberlotto

and btw, there are quite some forks (in the old sense of the word, not working copies) of other things in the raindropdevs organization. wonder if those are needed or could be merged back to their sources.

@matteocaberlotto
Copy link
Contributor

i will give a check at the internals of routing bundle to consider the use inside original cmf-routing.
At the moment i would consider just trying to append the orm dynamic router (after renaming) to the chain router since the logic is the same (as far as i remember).
we are also planning pull request for merging back features as far as they can be considered abstract enough for the original bundles.
anyway, any kind of request/suggestion is welcome.

@matteocaberlotto
Copy link
Contributor

my assumption on routing was based on the old version before decoupling the routing component so i guess it requires some more inspection

@ghost
Copy link

ghost commented Apr 28, 2013

i think this would be a game changer for all sorts of applications.
It'd be a nice gateway into the CMF world.

@matteocaberlotto : do you plan on working on this soon? And if so, how soon? I might take a look at it soon
if you don't plan on taking it on.

@matteocaberlotto
Copy link
Contributor

i gave a quick look at RoutingBundle, RaindropRoutingBundle and cmf-routing but i think i need some more knowledge on the cmf-routing internal changes: i made the fork long time ago.
The aim of the fork was to have db routes with free path and the option the bind another orm entity.
the orm routing is missing some features... it just maps pathinfo to an entity field for runtime retrieval. it has an 'home made' mapping mechanism to map route entites to other entities without having to establish doctrine relations at runtime and i was wondering if that could switch to a more elegant approach (are the enhancers meant to do that?).
Raindrop entity also does not feature route parameters... this because i haven't yet found a way to match pathinfo to parametric routes without having to compile them + use regexp that does not scale for thousands of routes.

UPDATE:
https://github.com/raindropdevs/RoutingBundle/tree/feature/orm-dynamic-router this "works" simply by appending another DynamicRouter that uses orm entities ported from raindrop one (it is not meant to be a pull request).
maybe the proper solution would be an alternate provider that allow using an orm entity (this could make possible to use parameters with parent + candidates approach, as odm does). but this solution requires to modify original dynamic router to let it use phpcr odm or orm (or both) according to configuration.

@dbu
Copy link
Member Author

dbu commented Apr 28, 2013

i am sure we can find a way to make this work! if we have some assumptions in the dynamic router that do not work, we can also refactor it where needed.

what i would see is:

  • an orm route provider that provides route entities from the orm.
  • if you want both phpcr and orm routes, you simply configure two instances of dynamic router. one dynamic router instance is for exactly one provider, otherwise it would duplicate what the chainrouter already does. there is no problem chaining 3 or more routers. (95% of the time i would not expect to have a project with both orm and phpcr routes. this is mostly about offering options)
  • regarding parameters, in phpcr we store the static part of the route and then a separate field for dynamic parts, then the route document puts them together. the route provider fetches all routes that could match the request. so /something/blogpost/37/abc would try to find /something/blogpost/37/abc, /something/blogpost/37, /something/blogpost, /something and / and then use symfony matching on the compiled routes. so a blogpost route probably would have the static part /something/blogpost and a dynamic part {id}/{slug}
  • regarding creating the content out of your reference, that is exactly what enhancers are meant for. for the orm you could store the entity class + primary key and have an enhancer knowing about the entity manager and look that up and place it into the parameters. see https://github.com/symfony-cmf/Routing/blob/master/Enhancer/RouteContentEnhancer.php (here its easy as the phpcr route can have a reference on arbitrary documents so we need no document manager)

@dbu
Copy link
Member Author

dbu commented May 23, 2013

see #95

@dbu dbu closed this as completed May 23, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants