<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of GrowthBidRecordOn
 *
 * @author Administrator
 */
class GrowthBidBlockExpertRecordHistory extends GrowthBidRecord {
    
    public function __construct($table='growth_bid_block_expert_record_history') {
            parent::__construct($table);
    }

    public function save($fieldData) {
        if(array_key_exists('broker_id', $fieldData)&&
                array_key_exists('bid_id', $fieldData)&&
                array_key_exists('house_id', $fieldData)) {
            $brokerId = $fieldData['broker_id'];
            $bidId = $fieldData['bid_id'];
            $houseId = $fieldData['house_id'];
            $record = $this->findOneBy($brokerId, $bidId, $houseId);
            if($record) {
                $conf = "broker_id='$brokerId' and bid_id='$bidId' and house_id='$houseId'";
                $this->update($fieldData, $conf);
                return $this->db->Affected_Rows();
            } else {
                $this->insert($fieldData);
                return $this->db->Affected_Rows();
            }
        } else {
            return false;
        }
        
    }
}

?>
