-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathModelInterface.php
127 lines (105 loc) · 2.18 KB
/
ModelInterface.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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
<?php
declare(strict_types=1);
/*
* Studio 107 (c) 2018 Maxim Falaleev
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Mindy\Orm;
use Doctrine\DBAL\Connection;
/**
* Interface ModelInterface.
*
* @property int|string $pk
*
* @method static \Mindy\Orm\Manager|\Mindy\Orm\TreeManager objects($instance = null)
*/
interface ModelInterface
{
/**
* @return array
*/
public function getAttributes();
/**
* @param null $instance
*
* @return Manager
*/
public static function objectsManager($instance = null);
/**
* @param bool $value
*/
public function setIsNewRecord($value);
/**
* @return bool
*/
public function getIsNewRecord();
/**
* @return MetaData
*/
public static function getMeta();
/**
* @return array
*/
public static function getFields();
/**
* @return bool
*/
public function isValid();
/**
* @param bool $asArray
*
* @return array|string
*/
public static function getPrimaryKeyName($asArray = false);
/**
* @param array $fields
*
* @return bool
*/
public function insert(array $fields = []);
/**
* @param array $fields
*
* @return bool
*/
public function update(array $fields = []);
/**
* @return bool
*/
public function delete();
/**
* @param array $fields
*
* @return bool
*/
public function save(array $fields = []);
/**
* @param array $row
*
* @return ModelInterface
*/
public static function create(array $row);
/**
* @return string
*/
public static function tableName();
/**
* @param array $attributes
*/
public function setAttributes(array $attributes);
/**
* @param string $name
* @param $value
*/
public function setAttribute($name, $value);
/**
* @return Connection
*/
public function getConnection();
/**
* @param Connection $connection
*/
public function setConnection(Connection $connection);
}