/** * Record a slug history from a given object in a standard way * * @param DataObject $object * @param string $slug * @return int */ public static function recordFromObject(DataObject $object, $slug) { if (!$object->ID) { return; } $history = new SlugHistory(); $history->RecordID = $object->ID; $history->ObjectClass = $object->ClassName; $history->Slug = $slug; return $history->write(); }