| Conditions | 3 |
| Paths | 3 |
| Total Lines | 22 |
| Code Lines | 12 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 30 | public function getManipulatedData(GridField $gridField, SS_List $dataList) |
||
| 31 | { |
||
| 32 | $objectID = $gridField->State->GridFieldAddRelation(null); |
||
| 33 | |||
| 34 | if(empty($objectID)) { |
||
| 35 | return $dataList; |
||
| 36 | } |
||
| 37 | |||
| 38 | $object = DataObject::get_by_id($dataList->dataclass(), $objectID); |
||
| 39 | |||
| 40 | if($object) { |
||
| 41 | $virtual = new ElementVirtualLinked(); |
||
| 42 | $virtual->LinkedElementID = $object->ID; |
||
| 43 | $virtual->write(); |
||
| 44 | |||
| 45 | $dataList->add($virtual); |
||
| 46 | } |
||
| 47 | |||
| 48 | $gridField->State->GridFieldAddRelation = null; |
||
| 49 | |||
| 50 | return $dataList; |
||
| 51 | } |
||
| 52 | } |
||
| 53 |
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.