/
Relation.php
49 lines (43 loc) · 1.2 KB
/
Relation.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
<?php
namespace SilverStripe\ORM;
use SilverStripe\ORM\FieldType\DBField;
/**
* Abstract representation of a DB relation field, either saved or in memory
*
* Below methods will be added in 5.x
*
* @method Relation relation($relationName)
* @method Relation forForeignID($id)
* @method string dataClass()
*
* @template T
* @extends SS_List<T>
* @extends Filterable<T>
* @extends Sortable<T>
* @extends Limitable<T>
*/
interface Relation extends SS_List, Filterable, Sortable, Limitable
{
/**
* Sets the ComponentSet to be the given ID list.
* Records will be added and deleted as appropriate.
*
* @param array<int> $idList List of IDs.
*/
public function setByIDList($idList);
/**
* Returns an array with both the keys and values set to the IDs of the records in this list.
*
* Does not return the IDs for unsaved DataObjects
*
* @return array<int>
*/
public function getIDList();
/**
* Return the DBField object that represents the given field on the related class.
*
* @param string $fieldName Name of the field
* @return DBField The field as a DBField object
*/
public function dbObject($fieldName);
}