Hu !

Add in requirements : sf_method: [get, post]

By default, i think only get is accepted, so it skip the route.

This should fix the problem


2009/10/13 HAUSa <[email protected]>

>
> With url_for('@user_activate', $user); I got an error, but without the
> @ it works.
>
> Now I changed the route to this:
>
> user_activate:
>  url:     /user-activate/:id
>  class:   sfPropelRoute
>  options: { model: User, type: object }
>  param:   { module: user, action: activate }
>
> When I type in the URL (/website_dev.php/user-activate/1), it shows
> the page correctly. Then, when I submit a form to the exact same URL,
> it says "Action "useractivate/1" does not exist.".
> I guess the fact that it searches for a module named useractivate and
> a action that is named 1, means that it takes the default route yet
> again. On a form submit, it just doesn't recognize the route class
> "user_activate"!
>
> This is really weird!
>
>
>
> On 12 okt, 12:10, Alexandre SALOME <[email protected]> wrote:
> > For the route, use :
> >
> > url_for('@user_activate', $user);
> >
> > Could you try a simple thing ?
> >
> > Change your URL : set something like /user-activate/:id
> >
> > Does it works like this ?
> >
> > 2009/10/12 HAUSa <[email protected]>
> >
> >
> >
> >
> >
> > > With the requirements it works, the url_for('@user_activate?id=' .
> > > $user->getId()) didn't have any effect.
> > > But what is the difference with the requirements? It's strange that it
> > > doesn't take the user_activate route in first place, because I placed
> > > it on top of my routing.yml document...
> >
> > > On 9 okt, 18:18, Alexandre SALOME <[email protected]> wrote:
> > > > 1 => true in routing parameters...
> >
> > > > Strange...
> >
> > > > Try adding :
> >
> > > > *requirements*:
> > > >         id: \d+
> >
> > > > Finally :
> >
> > > > user_activate:
> > > >   url:     /user/activate/:id
> > > >   class:   sfPropelRoute
> > > >   options: { model: User, type: object }
> > > >   param:   { module: user, action: activate }
> > > >   requirements:
> > > >     id: \d+
> >
> > > > 2009/10/9 NairuS <[email protected]>
> >
> > > > > 2009/10/9 HAUSa <[email protected]>
> >
> > > > >> Hey, this is weird! I checked the log like you said Alexandre, and
> it
> > > > >> matches just the default one...
> >
> > > > >> Oct 09 10:17:36 symfony [info] {sfPatternRouting} Connect
> > > > >> sfPropelRoute "user_activate" (/user/activate/:id)
> > > > >> Oct 09 10:17:36 symfony [info] {sfPatternRouting} Connect
> > > > >> sfPropelRoute "user_edit" (/user/edit/:id)
> > > > >> Oct 09 10:17:36 symfony [info] {sfPatternRouting} Connect sfRoute
> > > > >> "homepage" (/)
> > > > >> Oct 09 10:17:36 symfony [info] {sfPatternRouting} Connect sfRoute
> > > > >> "default_index" (/:module)
> > > > >> Oct 09 10:17:36 symfony [info] {sfPatternRouting} Connect sfRoute
> > > > >> "default" (/:module/:action/*)
> > > > >> Oct 09 10:17:36 symfony [info] {sfPatternRouting} Match route
> > > > >> "default" (/:module/:action/*) for /user/activate/1 with
> parameters
> > > > >> array (  1 => true,  'module' => 'user',  'action' => 'activate',)
> >
> > > > >> But why doesn't it match "user_active"? The URL is correct!
> > > > >> /website_dev.php/user/activate/1
> >
> > > > >> On 9 okt, 10:15, HAUSa <
> [email protected]>
> > > > >> wrote:
> > > > >> > Ah, the URL problem is solved. I had to use
> url_for('user_activate',
> > > > >> > $user), and not url_for('@user_activate', $user) (mind the @).
> >
> > > > > Yep it's true.
> >
> > > > > Sorry! With this syntax :
> > > > >   > url_for('@user_activate?id=' . $user->getId())
> >
> > > > > it must work too.
> >
> > > > >> > But, the form problem still remains.
> > > > >> > When I submit my form, it says
> > > > >> > "Fatal error: Call to undefined method sfRoute::getObject() in
> > > /home/
> > > > >> > snuber/domains/
> snuber.net/public_html/apps/website/modules/user/
> > > > >> > actions/actions.class.php on line 59"
> >
> > > > >> > This is my form now:
> > > > >> > <form id="form_user_activate" action="<?php echo url_for
> > > > >> > ('user_activate', $user) ?>" method="post"
> enctype="multipart/form-
> > > > >> > data">
> >
> > > > >> > On 9 okt, 09:50, Alexandre SALOME <[email protected]>
> > > wrote:
> >
> > > > >> > > Sure, your configuration is OK.
> >
> > > > >> > > Maybe the routing match another route before this one.
> >
> > > > >> > > Please check in the logs and tell us,
> >
> > > > >> > > look if you do you have any other rule that could catch your
> url
> > > > >> before ?
> >
> > > > >> > > Use the task *./symfony app:routes websites* to get the list
> of
> > > the
> > > > >> app
> > > > >> > > routes.
> >
> > > > >> > > Alexandre
> >
> > > > >> > > 2009/10/9 HAUSa <[email protected]>
> >
> > > > >> > > > Can someone help me with this please?
> > > > >> > > > It's really becoming an obstacle in my development process
> > > now... :(
> >
> > > > >> > > > On 8 okt, 21:01, HAUSa <
> > > [email protected]>
> > > > >> > > > wrote:
> > > > >> > > > > I have this route:
> >
> > > > >> > > > > user_activate:
> > > > >> > > > >   url:     /user/activate/:id
> > > > >> > > > >   class:   sfPropelRoute
> > > > >> > > > >   options: { model: User, type: object }
> > > > >> > > > >   param:   { module: user, action: activate }
> >
> > > > >> > > > > Now, in the page where that route leads to, I have a form.
> The
> > > > >> form is
> > > > >> > > > > being sent to that route again:
> > > > >> > > > > <form id="form_user_user_activate"
> > > action="/website_dev.php/user/
> > > > >> > > > > activate/1" method="post" enctype="multipart/form-data">
> >
> > > > >> > > > > But, when I post that form, I get this error message:
> > > > >> > > > > Fatal error: Call to undefined method sfRoute::getObject()
> in
> > > > >> /home/
> > > > >> > > > > snuber/domains/
> > > snuber.net/public_html/apps/website/modules/user/
> > > > >> > > > > actions/actions.class.php on line 30
> >
> > > > >> > > > > It is still the very same URL! The route should work,
> > > shouldn't
> > > > >> it?
> >
> > > > >> > > --
> > > > >> > > Alexandre Salomé -- [email protected]
> >
> > > > --
> > > > Alexandre Salomé -- [email protected]
> >
> > --
> > Alexandre Salomé -- [email protected]
> >
>


-- 
Alexandre Salomé -- [email protected]

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