public function insert($attributes = null) { $succeeded = parent::insert($attributes); // Alter and save the nameId field: if ($succeeded && self::$autoPopulateFields) { $this->updateNameId(true); if ($this->hasEventHandler('onAfterInsert')) { $this->onAfterInsert(new CEvent($this)); } } return $succeeded; }