Hi!

I've encountered a strange problem with routing in my symfony 1.2 with
doctrine application. I tracked it down to routing cache problems.

I have two routes:

user_edit_profile:
  url: /user/:nick/settings
  class:   sfDoctrineRoute
  options: { model: sfGuardUserProfile, type: object }
  param: { module: user, action: settings }
  requirements:
    sf_method: [get, post]

user_edit_own_profile:
  url: /user/settings/*
  param: { module: user, action: ownSettings }

The first one enables administrators to easily edit any user profile,
the second one is provided for convenience for an end user.

The action ownSettings is secured in security.yml and looks like that:

public function executeOwnSettings(sfRequest $request) {
  $this->redirect($this->generateUrl("user_edit_profile", $this-
>getUser()->getGuardUser()->getProfile()));
}

The scenario is:

1) I login with an account "maticomp". I go to /user/settings and am
redirected to /user/maticomp/settings.
2) I logout and log in with another account "test". I go to /user/
settings and am redirected to ... /user/maticomp/settings

I modified the action to print some debug information instead of doing
redirects:

public function executeOwnSettings(sfRequest $request) {
  print $this->getUser()->getGuardUser()->getProfile()->getNick() .
"<br>";
  print $this->generateUrl("user_edit_profile", $this->getUser()-
>getGuardUser()->getProfile());
  return sfView::NONE;
}

The result now is:

test
index.php/user/maticomp/settings

After doing "symfony cc" in command line it's:

test
index.php/user/test/settings

The problem is non existent in dev environment (where I guess routing
cache is disabled). It is also non-existent when I disable access to
the directory where route cache is stored (chmod 222 routing).

What could be the possible reason that Symfony caches complete routing
info when objects are passed to sfDoctrineRoute? Maybe I am missing
something here?

I would be very glad for any suggestions how to deal with this
problem.


Thanks in advance,

Best regards,
Mateusz Papiernik

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to 
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/symfony-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to