I am not sure how much help I'll be because I am chewing on the same
issue, but i I an observation that may help.
The way the admin generator "does" fillters is as a nested array:
[filters/[field][value] -- I don't know how to go that deep in
routing.yml.
Think out loud, one possible solution might be to make filter an
action that prepopulatesr $criteria and then calls list
On Apr 2, 10:25 am, Jill Elaine <[EMAIL PROTECTED]> wrote:
> Well, this is harder than I thought it might be!
> It took a while for me to just get a link that took me to a filtered
> page. It is not as simple as one might think. This doesn't work:
> -php echo link_to('Coordinator - Mathews', 'coordinator/list?
> lastname=Mathews') -
> It just goes to the coordinator list page unfiltered.
>
> My example link with filter:
> -php echo link_to('Coordinator - Mathews', 'coordinator/list?
> filters[lastname]=Mathews&filter=filter') -
> This link works and takes me to the 'coordinator' list page with only
> the requested record(s) displayed: lastname = Mathews
>
> The URL in the address bar when the above link is
> clicked:http://mysite.com/coordinator/list/filters%5Blastname%5D/Mathews/filt...
>
> Now, how to make a routing rule that will 'clean' up the link?
> I tried this in routing.yml:
> coordinator_name:
> url: /coordinator/:filters[lastname]
> param: { module: course_coordinator, action: list, filter: filter }
>
> And the routing rule is found but the list is NOT filtered to lastname
> = Mathews even though the desired URL returned
> is:http://mysite.com/coordinator/Mathews but the list is unfiltered.
>
> In my log, I see the routing rule parsed:
> Apr 02 09:46:57 symfony [info] {sfRouting} match route
> [coordinator_name] "/coordinator/:filters[lastname]"
> Apr 02 09:46:57 symfony [info] {sfRequest} request parameters array
> ( 'filters[lastname]' => 'Mathews', 'module' => 'coordinator',
> 'action' => 'list', 'filter' => 'filter',)
> but too bad it doesn't produce the desired results!
>
> I tried this in routing.yml:
> coordinator_name:
> url: /coordinator/:filters[lastname]
> param: { module: course_coordinator, action: list, filter: filter,
> filters[lastname] }
> But it produces error:
> Fatal error: Unsupported operand types in ...symfony/util/
> Spyc.class.php on line 667
>
> This snippet looks interesting, but not really what we
> want:http://www.symfony-project.org/snippets/snippet/146
>
> I think this is the code in sfRouting.class.php that does the parsing:
> 77 public function getCurrentInternalUri($with_route_name =
> false)
> 78 {
> 79 if ($this->current_route_name)
> 80 {
> 81 list($url, $regexp, $names, $names_hash, $defaults,
> $requirements, $suffix) = $this->routes[$this->current_route_name];
> 82
> 83 $request = sfContext::getInstance()->getRequest();
> 84
> 85 if ($with_route_name)
> 86 {
> 87 $internal_uri = '@'.$this->current_route_name;
> 88 }
> 89 else
> 90 {
> 91 $internal_uri = $request->getParameter('module',
> isset($defaults['module']) ? $defaults['module'] :
> '').'/'.$request->getParameter('action', isset($defaults['action']) ?
>
> $defaults['action'] : '');
> 92 }
> 93
> 94 $params = array();
> 95
> 96 // add parameters
> 97 foreach ($names as $name)
> 98 {
> 99 if ($name == 'module' || $name == 'action') continue;
> 100
> 101 $params[] = $name.'='.$request->getParameter($name,
> isset($defaults[$name]) ? $defaults[$name] : '');
> 102 }
> 103
> 104 // add * parameters if needed
> 105 if (strpos($url, '*'))
> 106 {
> 107 foreach ($request->getParameterHolder()->getAll() as $key
> => $value)
> 108 {
> 109 if ($key == 'module' || $key == 'action' ||
> in_array($key, $names))
> 110 {
> 111 continue;
> 112 }
> 113
> 114 $params[] = $key.'='.$value;
> 115 }
> 116 }
>
> There must be some way to route filtered pages?? Can anyone please
> help?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"symfony users" 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-users?hl=en
-~----------~----~----~----~------~----~------~--~---