/** * Saves the site, makes sure a default site is selected * @param Site $site The site to save * @return null */ protected function saveData($site) { $isNew = $site->id ? false : true; parent::saveData($site); if (!$isNew) { return; } $query = $this->createQuery(0); $numSites = $query->count(); if ($numSites == 1) { $this->setDefaultSite($site); } }
/** * Saves a post * @param joppa\forum\model\data\ForumPostData $data Post to save * @return null */ protected function saveData($data) { if (!$data->id) { $topicModel = $this->getModel(ForumTopicModel::NAME); $data->topicPostNumber = $topicModel->getNewPostNumber($data->topic); } if ($data->author && !is_numeric($data->author) && $data->author->id) { $data->author = $data->author->id; } parent::saveData($data); if ($data->author) { $profileModel = $this->getModel(ForumProfileModel::NAME); $profileModel->addPost($data->author); } }