This is what I have used to set values before saving a form with the
user already logged in:

lib/model/doctrine/Listing.class.php:

class Listing extends BaseListing
{
  public function save(Doctrine_Connection $conn = null) {
      $this->setUsername(sfContext::getInstance()->getUser()-
>getUsername());
      return parent::save($conn);
  }
}



On May 8, 9:24 pm, Billy Paradise <billyparad...@gmail.com> wrote:
> Hi,
>
> I'm trying to create a form, like a "shoutbox".
>
> A user is logged in via sfGuard
>
> They create new post.  I'm using the Jobeet example. The commented out
> lines are what I thought would work. The "somebody" line works, but if
> I try to insert the currently logged in username into the posted_by
> column, it bombs out with the error:
>
> Unknown method sfGuardUserTable::getUser
>
> lib/model/doctrine/Listing.class.php:
>
> class Listing extends BaseListing
> {
>
>   public function save(Doctrine_Connection $conn = null)
>   {
> //  $username=Doctrine_Core::getTable('sfGuardUser')->getUser();
>
>   if (!$this->getPostedBy())
>   {
> //    $this->setPostedBy($username);
>     $this->setPostedBy('somebody');
>   }
>
>   return parent::save($conn);
>
> }
>
> Please show me where I'm going wrong. Thanks!
>
> --
> If you want to report a vulnerability issue on symfony, please send it to 
> security at symfony-project.com
>
> 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 
> athttp://groups.google.com/group/symfony-users?hl=en

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

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