`$username=Doctrine_Core::getTable('sfGuardUser')->getUser();` after executing this line, the value of $username is an sfGuardUser object. You try to pass it to a function that expects a string. What you need is this:
`$username=Doctrine_Core::getTable('sfGuardUser')->getUser()->getUsername();` On Sat, May 8, 2010 at 21:24, 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 at > http://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