Skip to content

Instantly share code, notes, and snippets.

@damienalexandre
Forked from ternel/gist:768060
Created January 6, 2011 15:57
Show Gist options
  • Save damienalexandre/768069 to your computer and use it in GitHub Desktop.
Save damienalexandre/768069 to your computer and use it in GitHub Desktop.
<?php
class Answer extends BaseAnswer
{
public function preSave($event)
{
if ($this->getIsTrue())
{
$q = Doctrine_Query::create()
->update('Answer')
->set('is_true', false)
->where('question_id = ?', $this->getQuestionId())
->andWhere('id != ?', $this->getId());
$q->execute();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment