I found a solution not very pretty but it works for the moment ... but
if someone has a solution I take.
#factories.yml
  routing:
    class: myPatternRouting



class myPatternRouting extends sfPatternRouting
{
  public function connect($name, $route)
  {
    $routes = $route instanceof sfRouteCollection ? $route :
array($name => $route);
    foreach (self::flattenRoutes($routes) as $name => $route)
    {
      $this->routes[$name] = $route;
      $this->configureRoute($route);

      if ($this->options['logging'])
      {
        $this->dispatcher->notify(new sfEvent($this,
'application.log', array(sprintf('Connect %s "%s" (%s)',
get_class($route), $name, $route->getPattern()))));
      }
    }
  }

  static public function flattenRoutes($routes)
  {
    $flattenRoutes = array();
    foreach ($routes as $name => $route)
    {
      if ($route instanceof sfRouteCollection)
      {
        $flattenRoutes = array_merge($flattenRoutes,
self::flattenRoutes($route));
      }
      else
      {
        if($route instanceof sfRoute)
        {
          $route = new myHostRoute($route);
        }
        $flattenRoutes[$name] = $route;
      }
    }

    return $flattenRoutes;
  }
}


On 17 fév, 09:21, Mathieu Tricoire <[email protected]> wrote:
> Hi raphael,
> Yes it's for all routes, I just want define my own generator route
> class to add an option for generate url function to manage subdomain.
> For example I define my host in app.yml like that :www.domain.com
> And in my routing
>
> # If the current host is default host, generate relative url else an
> absolute url with the default host (if we no define absolute...)
> because no sub option defined
> # inwww.domain.comthis route generate => /blog-list
> # in myblog.domain.com this route generate =>http://www.domain.com/blog-list
> blog_list:
>   url:   /blog-list
>   param: { module: Blog, action: index }
>
> # Generate a relative url because sub option is true
> blog:
>   url:     /blog
>   param:   { module: Blog, action: show }
>   options: { sub: true }
>
> thx for you reply, and sorry for my poor english ;-)
>
> On 17 fév, 00:03, Raphael Schumacher <[email protected]>
> wrote:
>
>
>
> > My apologies if I misunderstood your question, and perhaps you may
> > elaborate a bit more on your specific situation. You want to replace
> > sfRoute by your own class in general for all routes (unless explicitly
> > specified in routing.yml)? What sort of routes have you then defined
> > in routing.yml, e.g. sfDoctrineCollectionRoute/
> > sfPropelCollectionRoute? (I guess you must still have some sort of
> > route definitions in there, right?)

-- 
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.

Reply via email to