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

Allow use of content_change strategy in non-building context #41

Open
dantleech opened this issue Nov 29, 2013 · 9 comments
Open

Allow use of content_change strategy in non-building context #41

dantleech opened this issue Nov 29, 2013 · 9 comments

Comments

@dantleech
Copy link
Member

Allow the on_content_change strategy to be applied to route classes for which the RoutingAuto bundle doesn't build the routes automatically.

  • Allow specification of HEAD route (content_name route).
  • Ensure that we can not enable the "building" logic.
@dantleech
Copy link
Member Author

@nicolas-bastien for your use case would using the content_change strategy (basically being able to select a strategy to employ when the content of a route is changed) solve your use case?

Is there a reason why you cannot use the full RoutingAutoBundle implementation?

@dbu
Copy link
Member

dbu commented Nov 30, 2013

@nicolas-bastien how is your form widget to generate the route exactly working? could we bring that as far upstream as possible (either into sonata admin, but maybe even as a form type provided by RoutingAutoBundle)? it would be a very valueable addition.

your simple case (specify the last part of the url) could be integrated with the routing auto bundle.

the other case of editing the full url is probably more tricky, but maybe you could use the routing auto bundle to make the suggested path, and to autocreate missing pieces in the route according to its logic. how do you currently do that? does it depend on the url of the currently selected parent? RoutingAutoBundle has a rich configuration for how to generate the missing parents, which would add flexibility and spare you reinventing that wheel one bit at a time.

@dantleech
Copy link
Member Author

Actually, specifying the entire URL from a text field is easy with RoutingAutoBundle - you would just need to setup a content_path provider which gets the path from a method on the Document (which can be a text field and which can thus be edited from a form)

@dbu
Copy link
Member

dbu commented Nov 30, 2013

hm, is there a way we could keep the field out of the content document? would feel a bit strange to have a text field with the desired url that is only used by RoutingAutoBundle. a custom form type should be able to handle that i think. @nicolas-bastien how are you currently doing that?

@nicolas-bastien
Copy link
Member

Hi thanks for your answers !

I did my developments with my custom page and have a custom listener and a RouteManager which handle route creation + update for a page.

I have a relative and absolute url mode + more needs in the future to add parameters....

So urls are not stored in my pages, I use the route directly.

@dantleech I don't get why I need to add routing auto bundle as the real need behind is to create a redirect when a route is moved. This is a global routing issue ?

For my part I already have the code :
https://github.com/prestaconcept/PrestaCMSCoreBundle/blob/master/Model/RouteManager.php

L313 : generateRedirects methods

It only fails because of UoW process.

So my problem is the same as @dantleech one : #37 (comment)

@dantleech
Copy link
Member Author

@nicolas-bastien I guess I am asking if RoutingAuto could replace your custom implementation - and then you would get the Redirects for free - but the change I am suggesting here would enable you to automatically create a RedirectRoute when the content linked to a route changes.

@nicolas-bastien
Copy link
Member

I understand but for me at the moment it will be faster to uncomment my //return; in my method as I already did all the job before you did RoutingAutoBundle.

I just miss the correction of UoW like you said in your comment.

Do you know when it can be changed ?

@dbu
Copy link
Member

dbu commented Dec 2, 2013

we said that fixing the UoW to allow this scenario is more complicated, so the plan is to have a listener that records url changes and on postFlush creates the redirect routes and does another flush.

automatically creating redirect routes when moving routes is a kind of auto-generating routes, so i think it fits well into this bundle. it would be great if we manage to make this work here and you could use that bundle (even if you do not use the functionality to autogenerate urls for new documents, but only to generate redirects.)

@nicolas-bastien
Copy link
Member

ok understood

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