-
Notifications
You must be signed in to change notification settings - Fork 0
/
Article.php
85 lines (72 loc) · 1.57 KB
/
Article.php
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
<?php
namespace App\Models;
/**
* Article article
*
* generated by ddl-to-object <https://github.com/ycrao/ddl-to-object>
*
* @property integer $id id
* @property integer $user_id 用户id
* @property string $content 正文
* @property mixed|string $create_time 创建时间
* @property mixed|string $update_time 更新时间
* @author unknown
*/
class Article {
/**
* @var integer - id
*/
private $id = null;
/**
* @var integer - 用户id
*/
private $user_id = null;
/**
* @var string - 正文
*/
private $content = null;
/**
* @var mixed|string - 创建时间
*/
private $create_time = null;
/**
* @var mixed|string - 更新时间
*/
private $update_time = null;
/**
* construct from object or array
*
* @param object|array $object
* @return void
*/
public function __construct($object = null) {
if (is_array($object) || is_object($object)) {
foreach ($object as $key => $value) {
$this->$key = $value;
}
}
}
/**
* magic get
*
* @param property name $key
* @return mixed
*/
public function __get($key) {
return $this->$key;
}
/**
* magic set
*
* @param property name $key
* @param property value $value
* @return boolean
*/
public function __set($key, $value) {
if (property_exists($this, $key)) {
$this->$key = $value;
return true;
}
return false;
}
}