<commit_before><?php
/**
 * Subclass for representing a row from the 'sf_polls' table.
 *
 * @package plugins.sfPropelPollsPlugin.lib.model
 */
class sfPoll extends BasesfPoll
{

  /**
   * Add a sfPollAnswer object related to current sfPoll object instance
   *
   * @param  string  $answer_text
   * @return sfPollAnswer
   * @throws sfPropelPollsException
   **/
  public function addAnswer($answer_text)
  {
    if ($this->isNew() or is_null($this->getId()))
    {
      throw new sfPropelPollsException('You cannot add an answer to an unsaved poll');
    }
    $answer = sfPollAnswerPeer::getOrCreate($this->getId(), $answer_text);
    $answer->setsfPoll($this);
    $answer->setName($answer_text);
    $answer->save();<commit_msg>[wiki:sfPropelPollsPlugin] Added a `__toString()` method to a model class<commit_after><?php
/**
 * Subclass for representing a row from the 'sf_polls' table.
 *
 * @package plugins.sfPropelPollsPlugin.lib.model
 */
class sfPoll extends BasesfPoll
{
  /**
   * Add a sfPollAnswer object related to current sfPoll object instance
   *
   * @return String
   **/
  public function __toString()
  {
    return $this->getTitle();
  }
  
  /**
   * Add a sfPollAnswer object related to current sfPoll object instance
   *
   * @param  string  $answer_text
   * @return sfPollAnswer
   * @throws sfPropelPollsException
   **/
  public function addAnswer($answer_text)
  {
    if ($this->isNew() or is_null($this->getId()))
    {
      throw new sfPropelPollsException('You cannot add an answer to an unsaved poll');
    }
    $answer = sfPollAnswerPeer::getOrCreate($this->getId(), $answer_text);
    $answer->setsfPoll($this);
    $answer->setName($answer_text);
    $answer->save();
{'fraction_non_alphanumeric': 0.1266044340723454, 'fraction_numerical': 0.0, 'mean_word_length': 3.685792349726776, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 16, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7017374', 'n_tokens_mistral': 572, 'n_tokens_neox': 564, 'n_words': 140}