Hello there!

I added a constraint at the model to limits the current user to ready
only messages addresed to him.

The problem is that the route model only executes the query after I
called the getObject method in the action.

I would like to ban the user to the 404 page without calling the
getObejct method in the action, the same behavior that one gets if I
send a char instead of an integer.

Feature or bug?


I did this:

routing.yml

message:
  url:     /message/:id
  class:   sfDoctrineRoute
  options:
    model: Message
    type:  object
    method_for_query: getMessageToCurrentUser
  param:   { module: messages, action: view }
  requirements:
    id: \d+
    sf_method: [GET]

and the model:

  public function getMessageToCurrentUser (Doctrine_Query $q){
    $alias = $q->getRootAlias();

    $q->andWhere($alias . '.to_id = ?',
sfContext::getInstance()->getUser ()->getGuardUser()->id);
    return $q->fetchOne();
  }

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