I know it's not ideal, but I have a few extra fields on the sfGuard User table and I would like to write to it from another module. There is a specific field that is a simple integer but I would like it to -1 each time they perform a specific task. Here is what I tried. I don't get an error message but it also doesn't write the number to the table.
public function executePublish(sfWebRequest $request)
{
$this->user = $this->getUser()->getGuardUser();
$times = ($this->user->getTimes() - 1);
$this->getUser()->getGuardUser()->setTimes($times);
}
This is the "Publish" action for a different module. Am I doing this wrong? Thanks.
You didn't maked an INSERT to the database by setTimes($times)
you have to call save()
method after setting all values of object.
It should look like this:
public function executePublish(sfWebRequest $request)
{
$this->user = $this->getUser()->getGuardUser();
$times = ($this->user->getTimes() - 1);
$this->user->setTimes($times);
$this->user->save();
}