/
DataObjectInterface.php
61 lines (54 loc) · 2.17 KB
/
DataObjectInterface.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
<?php
/**
* DataObjectInterface is an interface that other data systems in your application can implement in order to behave in a manner
* similar to DataObject.
*
* In addition to the methods defined below, the data of the object should be directly accessible as fields.
* @package framework
* @subpackage model
*/
interface DataObjectInterface {
/**
* Create a new data object, not yet in the database. To load an object into the database, a null object should be constructed,
* its fields set, and the write() method called.
*/
function __construct();
/**
* Perform a search query on this data source
*
* @param $filter A filter expression of some kind, in SQL format.
* @param $sort A sort expression, in SQL format.
* @param $join A join expression. May or may not be relevant.
* @param $limit A limit expression, either "(count)", or "(start), (count)"
*/
function instance_get($filter = "", $sort = "", $join = "", $limit = "", $containerClass = "DataObjectSet");
/**
* Retrieve a single record from this data source
*
* @param $filter A filter expression of some kind, in SQL format.
* @param $sort A sort expression, in SQL format.
* @param $join A join expression. May or may not be relevant.
* @param $limit A limit expression, either "(count)", or "(start), (count)"
*/
function instance_get_one($filter, $sort = "");
/**
* Write the current object back to the database. It should know whether this is a new object, in which case this would
* be an insert command, or if this is an existing object queried from the database, in which case thes would be
*/
function write();
/**
* Remove this object from the database. Doesn't do anything if this object isn't in the database.
*/
function delete();
/**
* Get the named field.
* This function is sometimes called explicitly by the form system, so you need to define it, even if you use the
* default field system.
*/
function __get($fieldName);
/**
* Save content from a form into a field on this data object.
* Since the data comes straight from a form it can't be trusted and will need to be validated / escaped.'
*/
function setCastedField($fieldName, $val);
}