I was just going to respond that Username would be in the join with User and
so you would need to use getUser() to get the Username from the join itself

On Mon, Nov 30, 2009 at 1:51 PM, tirengarfio <tirengar...@gmail.com> wrote:

> Solved: i made this mistake:
>
> <?php echo $mensaje->getUsername() ?> instead of <?php echo $mensaje-
> >getUser()->getUsername() ?>
>
> Javi
>
> On Nov 30, 5:57 am, tirengarfio <tirengar...@gmail.com> wrote:
> > Thanks Gábor, I finally use a query also.
> >
> > This time i would like to show the username of the person who send the
> > message next to the title and the text of the message.
> >
> > I've thought the solution could be execute this query below:
> >
> > class MensajeTable extends Doctrine_Table
> > {
> >
> >         public static function getMensajesUsuario($id)
> >         {
> >
> >                 $q = Doctrine_Query::create()
> >                   ->from('Mensaje m')
> >                   ->leftJoin('m.User u')
> >                   ->where('m.receptor_id = ?', $id);
> >
> >                 $m = $q->execute();
> >
> >                 return $m;
> >
> >         }
> >
> > }
> >
> > In the controller:
> >
> > class mensajeActions extends sfActions
> > {
> >   public function executeIndex(sfWebRequest $request)
> >   {
> >         $this->mensajes_usuario = MensajeTable::getMensajesUsuario
> > ($this->getUser()->getGuardUser()->getId());
> >
> >   }
> >
> > }
> >
> > And then showing the results of the query in a template in this way:
> >
> >     <?php foreach ($mensajes_usuario as $mensaje): ?>
> >
> >         <?php echo $mensaje->getTitulo() ?>
> >
> >         <?php echo $mensaje->getContenido() ?>
> >
> >         <?php echo $mensaje->getCreatedAt() ?>
> >
> >         <?php echo $mensaje->getUsername() ?>
> >
> >     <?php endforeach; ?>
> >
> > But when i get this error:
> >
> > Unknown method Mensaje::getUsername
> >
> > Do you know what is going wrong?
> >
> > For the Propel people: Do you know if the approach is at least right?
> >
> > Bye
> >
> > Javi
> >
> > On Nov 25, 10:01 am, Gábor Fási <maerl...@gmail.com> wrote:
> >
> > > Without any info on how you store the messages, my guess is:
> >
> > >     $c = new Criteria();
> > >     $c->add(MessagePeer::USER_ID, $this->getUser()->getId());
> > >     return MessagePeer::doSelect($c);
> >
> > > On Wed, Nov 25, 2009 at 13:45,tirengarfio<tirengar...@gmail.com>
> wrote:
> > > > Hi,
> >
> > > > as many of you have guessed im making a little social network.
> >
> > > > Now i need to fetch the messages of the user receives from other
> > > > members of the social network.
> >
> > > > The line below access to the first message sent to the user:
> >
> > > > $this->getUser()->getGuardUser()->getMessage();
> >
> > > > but.....Is there any way to fetch ALL the messages sent to the user??
> >
> > > > I have tried with getMessageS(), or writting that line inside a loop
> > > > but it doesnt work...:)
> >
> > > > Bye
> >
> > > > Javi
> >
> > > > --
> >
> > > > You received this message because you are subscribed to the Google
> Groups "symfony users" group.
> > > > To post to this group, send email to symfony-us...@googlegroups.com.
> > > > To unsubscribe from this group, send email to
> symfony-users+unsubscr...@googlegroups.com<symfony-users%2bunsubscr...@googlegroups.com>
> .
> > > > For more options, visit this group athttp://
> groups.google.com/group/symfony-users?hl=en.
>
> --
>
> You received this message because you are subscribed to the Google Groups
> "symfony users" group.
> To post to this group, send email to symfony-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> symfony-users+unsubscr...@googlegroups.com<symfony-users%2bunsubscr...@googlegroups.com>
> .
> For more options, visit this group at
> http://groups.google.com/group/symfony-users?hl=en.
>
>
>


-- 
Gareth McCumskey
http://garethmccumskey.blogspot.com
twitter: @garethmcc

--

You received this message because you are subscribed to the Google Groups 
"symfony users" group.
To post to this group, send email to symfony-us...@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