Hi devs! I have a common and generic, I think, hierarchical type app that I don't know how to attack with the admin generator. Let me make my case. :)
I have to build a multi-user app that can handles conventions (in the meaning of social events). Each user can create as many conventions as he wish, each convention can have several physical locations, and in each location many workshops can be done. This give me three obvious models: Convention, Location and Workshop. Each one has a generated admin interface with sf 1.2.2 (and propel). So far, so good. The problem is that, in the out-of-the-box admin interfaces, the user is forced to choose from a dropdown the convention and the location each time that a workshop is created. I want to create something more "natural", where the user can browse to the event page, and from a link in there can go to the contextualized locations page (where only locations for that convention are shown), and, from the locations page, to the contextualized workshops page (where only the workshops for the location are shown). And, of course, give him the ability to create/edit locations and workshops in function of this contextualizations without having to manually select the parent object. My main catch is to put the parameters in the urls and get them in the actions. Something like: /convention (conventions available) /convention/symfony-devs (details of the convention) /convention/symfony-devs/location (locations available) /convention/symfony-devs/location/sensio-hq/ (details of the location) /convention/symfony-devs/location/sensio-hq/workshop (workshops available) /convention/symfony-devs/location/sensio-hq/workshop/symfony12 (details of the workshop) If I can retrieve the parameters values in the actions, I can override the getPeerMethod of the GeneratorConfiguration classes with a method that displays only the filtered entries, or, maybe, use the filter forms with default -and hidden- field values for that (which one could be easier/better, btw? I didn't tried the second yet). I've already tried doing this route structures by changing the prefix_path in the sfPropelRouteCollection of the modules, where I did things like "/convention/:convention_slug/location" and "convention/:convention_slug/location/:location_slug/workshop", but I cannot get to those parameters being recognized (not with the virtual accessors way). It keeps throwing me an exception where the convention_slug/location_slug mandatory parameters are not found, I think, but not for sure (need more coffee), that is at the moment of create the links in the cached admin templates. If I put the parameters in a standard query string in the url, everything is ok. I can get the values in the actions, but I want nice urls (yes, I also want world peace :p). In other hand, If I write a custom route (a sfPropelRoute) with the desired structure for each action it also works, but in any of both cases, the admin generator is still trying to generate the template links with the sfPropelRouteCollection info, and all them will lose this url structure in the next click. As the new routing framework treats the urls as "first-class objects" (Fabien words), I'm tempted to believe that something like this can be done without so much pain. I'm right? Also because I read similar things in Jobeet, chapter 5 [*], where virtual accessors for slugified parameters are created, and chapter 16 [**], where the method of the route is changed to getForToken, to list only jobs for a token (change that actually I didn't achieved with custom sfPropelRoute's for admin generated modules). Sadly, the last things are only explained with normal sfPropelRoute objects in the book and, if there's a way, I cannot make them work with routes collections. This message grew too much. Better cut it here. :) I will appreciate ANY insight that you could give me. As I said at the begining, I think that this is a generic problem, maybe I'm just shooting flies with a cannon. I also appreciate you have reached this line. :) Thanks in advance! - Joel [*] http://www.symfony-project.org/jobeet/1_2/Propel/en/05#day_05_object_route_class [**] http://www.symfony-project.org/jobeet/1_2/Propel/en/16#day_16_sub_the_job_web_service --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "symfony developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/symfony-devs?hl=en -~----------~----~----~----~------~----~------~--~---
