<?php
/*
* 项目: iOrange(橘子)
* 作者: 离家出走(yzxh24)
* Email: yzxh24@gmail.com
* 主页: www.iorange.cc
*/
/* vim: set ts=4 sw=4: */
class PropertyLog extends Model
{
	public static function single($className = __CLASS__)
	{
		return parent::single($className);
	}

	public static function table()
	{
		return 'ig_property_log';
	}

    public function create($id, $data)
    {
        $table = $this->escape(self::table());
		$sql = "INSERT INTO $table SET ";
        
        $data['property_id'] = $id;
        $data['createdate'] = CDATETIME;
        $data['date'] = CDATE;
        
        foreach ($data as $key => $value)
		{
			$insert[] = self::getEscapeString($key, $value);
		}
        $sql .= implode(',', $insert);

        $this->Db()->query($sql);

        return $this->Db()->getInsertId();
    }
}
