public function preSave($event) { parent::preSave($event); if (!$this->hash) { $this->hash = dmString::random(8); } }