Total Complexity | 3 |
Total Lines | 40 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
14 | class DataList extends BaseDataList |
||
15 | { |
||
16 | /** |
||
17 | * @var GridField |
||
18 | */ |
||
19 | protected $gridField; |
||
20 | |||
21 | /** |
||
22 | * HasOneSelectorDataList constructor. |
||
23 | * @param GridField $gridField |
||
24 | */ |
||
25 | public function __construct(GridField $gridField) |
||
26 | { |
||
27 | $this->gridField = $gridField; |
||
28 | |||
29 | parent::__construct($gridField->getDataClass()); |
||
30 | } |
||
31 | |||
32 | /** |
||
33 | * Set the current selected record into the has one relation |
||
34 | * |
||
35 | * @param DataObject $item |
||
36 | * @return void |
||
37 | * @throws Exception |
||
38 | */ |
||
39 | public function add($item) |
||
40 | { |
||
41 | $this->gridField->setRecord($item); |
||
42 | } |
||
43 | |||
44 | /** |
||
45 | * Clear the record within the has one relation |
||
46 | * |
||
47 | * @param DataObject $item |
||
48 | * @return void |
||
49 | * @throws Exception |
||
50 | */ |
||
51 | public function remove($item) |
||
54 | } |
||
55 | } |
||
56 |