1 <?php
2 /**
3 * DataObjectInterface is an interface that other data systems in your application can implement in order to behave in a manner
4 * similar to DataObject.
5 *
6 * In addition to the methods defined below, the data of the object should be directly accessible as fields.
7 * @package sapphire
8 * @subpackage model
9 */
10 interface DataObjectInterface {
11 /**
12 * Create a new data object, not yet in the database. To load an object into the database, a null object should be constructed,
13 * its fields set, and the write() method called.
14 */
15 function __construct();
16
17 /**
18 * Perform a search query on this data source
19 *
20 * @param $filter A filter expression of some kind, in SQL format.
21 * @param $sort A sort expression, in SQL format.
22 * @param $join A join expression. May or may not be relevant.
23 * @param $limit A limit expression, either "(count)", or "(start), (count)"
24 */
25 function instance_get($filter = "", $sort = "", $join = "", $limit = "", $containerClass = "DataObjectSet");
26
27 /**
28 * Retrieve a single record from this data source
29 *
30 * @param $filter A filter expression of some kind, in SQL format.
31 * @param $sort A sort expression, in SQL format.
32 * @param $join A join expression. May or may not be relevant.
33 * @param $limit A limit expression, either "(count)", or "(start), (count)"
34 */
35 function instance_get_one($filter, $sort = "");
36
37 /**
38 * Write the current object back to the database. It should know whether this is a new object, in which case this would
39 * be an insert command, or if this is an existing object queried from the database, in which case thes would be
40 */
41 function write();
42
43 /**
44 * Remove this object from the database. Doesn't do anything if this object isn't in the database.
45 */
46 function delete();
47
48 /**
49 * Get the named field.
50 * This function is sometimes called explicitly by the form system, so you need to define it, even if you use the
51 * default field system.
52 */
53 function __get($fieldName);
54
55 /**
56 * Save content from a form into a field on this data object.
57 * Since the data comes straight from a form it can't be trusted and will need to be validated / escaped.'
58 */
59 function setCastedField($fieldName, $val);
60
61 }