<commit_before><?php
/**
 * Payment
 * @property integer $applicantID
 * @property integer $paymentTypeID
 * @property double $amount
 * @property enum $status
 * @property Applicant $Applicant
 * @property PaymentType $PaymentType
 * @property Doctrine_Collection $Variables
 * 
 * @package    jazzee
 * @subpackage orm
 */
class Payment extends Doctrine_Record{
  /**
   * @see Doctrine_Record_Abstract::setTableDefinition()
   */
  public function setTableDefinition(){
    $this->setTableName('payment');
    $this->hasColumn('applicantID', 'integer', null, array(
      'type' => 'integer',
     ));
    $this->hasColumn('paymentTypeID', 'integer', null, array(
      'type' => 'integer',
     ));
    $this->hasColumn('amount', 'double', null, array(
      'type' => 'double',
     ));
    $this->hasColumn('status', 'enum', null, array(
      'type' => 'enum',
      'values' => array(
        0 => 'pending',
        1 => 'settled',
        2 => 'rejected',
        3 => 'refunded',
      ),
     ));
  }

  /**
   * @see Doctrine_Record::setUp()
   */
  public function setUp(){
    parent::setUp();
    $this->hasOne('Applicant', array(
      'local' => 'applicantID',
      'foreign' => 'id',
      'onUpdate' => 'CASCADE')
    );

    $this->hasOne('PaymentType', array(
      'local' => 'paymentTypeID',
      'foreign' => 'id')
    );

    $this->hasMany('PaymentVariable as Variables', array(
      'local' => 'id',
      'foreign' => 'paymentID')
    );
  }
  
  public function pending(){
    $this->status = 'pending';
  }
}<commit_msg>Add getVar and setVar to Payment.<commit_after><?php
/**
 * Payment
 * @property integer $applicantID
 * @property integer $paymentTypeID
 * @property double $amount
 * @property enum $status
 * @property Applicant $Applicant
 * @property PaymentType $PaymentType
 * @property Doctrine_Collection $Variables
 * 
 * @package    jazzee
 * @subpackage orm
 */
class Payment extends Doctrine_Record{
  /**
   * @see Doctrine_Record_Abstract::setTableDefinition()
   */
  public function setTableDefinition(){
    $this->setTableName('payment');
    $this->hasColumn('applicantID', 'integer', null, array(
      'type' => 'integer',
     ));
    $this->hasColumn('paymentTypeID', 'integer', null, array(
      'type' => 'integer',
     ));
    $this->hasColumn('amount', 'double', null, array(
      'type' => 'double',
     ));
    $this->hasColumn('status', 'enum', null, array(
      'type' => 'enum',
      'values' => array(
        0 => 'pending',
        1 => 'settled',
        2 => 'rejected',
        3 => 'refunded',
      ),
     ));
  }

  /**
   * @see Doctrine_Record::setUp()
   */
  public function setUp(){
    parent::setUp();
    $this->hasOne('Applicant', array(
      'local' => 'applicantID',
      'foreign' => 'id',
      'onUpdate' => 'CASCADE')
    );

    $this->hasOne('PaymentType', array(
      'local' => 'paymentTypeID',
      'foreign' => 'id')
    );

    $this->hasMany('PaymentVariable as Variables', array(
      'local' => 'id',
      'foreign' => 'paymentID')
    );
  }
  
  /**
   * Get Variable by name
   * @param string $name
   * @return blob || NULL
   */
  public function getVar($name){
    foreach($this['Variables'] as $variable)
      if($variable->name == $name)return $variable->value;
    return self::$_null;
  }
  
  /**
   * Set Variable
   * @param string $name
   * @param string $value
   */
  public function setVar($name, $value){
    foreach($this['Variables'] as $variable)
      if($variable->name == $name)return $variable->value = $value;
    //create a new empty variable with that name
    $var = $this->Variables->get(null);
    $var->name = $name;
    $var->value = $value;
  }
  
  public function pending(){
    $this->status = 'pending';
  }
}
{'fraction_non_alphanumeric': 0.1810459251393682, 'fraction_numerical': 0.002123705866737457, 'mean_word_length': 2.876543209876543, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 61, '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': '4308877', 'n_tokens_mistral': 1223, 'n_tokens_neox': 1191, 'n_words': 267}