/** * persist - Persists a thread to the database. * * @param TopicInterface $thread * @return TopicInterface */ public function persist(TopicInterface $thread) { if ($thread->getId() > 0) { $this->update($thread, null, null, new TopicHydrator()); } else { $this->insert($thread, null, new TopicHydrator()); } return $thread; }
/** * createThread * * @param CategoryInterface $tag * @param ThreadInterface $thread * @return ThreadInterface */ public function createThread(CategoryInterface $tag, TopicInterface $thread) { $thread->setForumCategoryId($tag->getid()); $thread->setTimestampCreated(date("Y-m-d H:i:s")); $thread->setUserId($this->getServiceManager()->get('zfcuser_auth_service')->getIdentity()->getId()); $this->getEventManager()->trigger(__FUNCTION__, $thread, array('thread' => $thread)); $thread = $this->topicMapper->persist($thread); $this->getEventManager()->trigger(__FUNCTION__ . '.post', $thread, array('thread' => $thread)); return $thread; }