Source of file NLObjectReference.php
Size: 0,480 Bytes - Last Modified: 2021-12-23T10:05:39+00:00
/var/www/docs.ssmods.com/process/src/code/fields/NLObjectReference.php
123456789101112131415161718 | <?php /** * Used to represent references to ORM objects. When setValue is called, the object reference is looked up, and returned * as the value. * ClassName:ID */ class NLObjectReference extends Varchar { function setValue($value, $record = null) { $parts = explode(":", $value); if (!is_array($parts) || count($parts) != 2 || !ClassInfo::exists($parts[0]) || !is_numeric($parts[1])) { return; } $this->value = DataObject::get_by_id($parts[0], $parts[1]); } } |