-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathModel.php
57 lines (46 loc) · 1.14 KB
/
Model.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
<?php
namespace Greg\Orm;
class Model extends ModelAbstract implements \IteratorAggregate, \Countable, \ArrayAccess
{
use RowTrait;
public function cleanup()
{
$this->rows = [];
$this->rowsTotal = 0;
$this->rowsOffset = 0;
$this->rowsLimit = 0;
return parent::cleanup();
}
public function serialize()
{
return serialize([
$this->alias,
$this->primaryKey,
$this->autoIncrement,
$this->uniqueKeys,
$this->casts,
$this->fillable,
$this->guarded,
$this->rows,
$this->rowsTotal,
$this->rowsOffset,
$this->rowsLimit,
]);
}
public function unserialize($serialized)
{
[
$this->alias,
$this->primaryKey,
$this->autoIncrement,
$this->uniqueKeys,
$this->casts,
$this->fillable,
$this->guarded,
$this->rows,
$this->rowsTotal,
$this->rowsOffset,
$this->rowsLimit,
] = unserialize($serialized);
}
}