1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
<?php
/**
* DynamicData
*
* $Id: KoalaDynamicData.inc,v 1.1 2015/10/08 11:18:57 wanggb Exp $
* @access public
* @package jp.fishow.entity
*/
class CompassDynamicData extends EntityBase{
/**
* ID。KoalaDynamicData
* @var int
*/
public $id;
public $registration_date;
/**
*
*
* @access public
* @param array $record DynamicData
*/
public function __construct($record = null) {
if ($record != null) {
$this->constructor($record);
}
}
/**
*
* @access private
* @param array $record MazaEntity
*/
public function constructor($record) {
$this->id = $record["id"];
$this->registration_date = $record["registration_date"];
}
/**
*
*
* @abstract
*/
// public function getList($w_param, $orderkey = null, $direction = "ASC", $offset = null, $limit = null) {
// ErrorLogger::doOutput("abstract getList called!", 0);
// }
/**
*
*
* @abstract
*/
public function save() {
ErrorLogger::doOutput("abstract save called!", 0);
}
public function _save($table_name, $v_param, $force = false) {
$db = CompassDBManager::getInstance();
if ((isset($this->id)) && (!$force)) {
//
$w_param = array();
$w_param["id"] = $this->id;
//
$db->doUpdate($table_name, $w_param, $v_param);
} else {
//
if (!isset($this->registration_date)) {
$v_param["registration_date"] = date("Y-m-d H:i:s");
} else {
$v_param["registration_date"] = $this->registration_date;
}
// insert
$result = $db->doInsertAndReturn($table_name, $v_param);
if (is_array($result) && count($result) > 0) {
//
$this->constructor($result[0]);
}
}
}
}
?>