getId() public method

Gets the value of id.
public getId ( ) : mixed
return mixed
 public function it_should_return_a_path_of_the_topic(JsonSerializationVisitor $visitor, Topic $topic, $topicRepository)
 {
     $topic->getId()->willReturn(1);
     $topic->getTitle()->willReturn("Test topic");
     $topic->getParent()->willReturn("Parent topic");
     $topicRepository->getReadablePath($topic)->willReturn(" / Parent topic / Test topic");
     $type = array('name' => "topic_path", 'params' => array());
     $this->serializeToJson($visitor, $topic, $type)->shouldReturn(" / Parent topic / Test topic");
 }
Example #2
0
 /**
  * Get topic id
  *
  * @return int
  */
 public function getTopicId()
 {
     return $this->topic->getId();
 }
Example #3
0
 /**
  * Deletes the topic. If topic is attached to any article
  * it is first detached and deleted.
  *
  * @param Topic $topic Topic
  *
  * @return bool
  */
 public function deleteTopic(Topic $topic)
 {
     if ($this->isAttached($topic->getId())) {
         $this->removeTopicFromAllArticles($topic->getId());
     }
     $this->removeTopicFromAllUsers($topic->getId());
     $this->em->remove($topic);
     $this->em->flush();
     $this->em->clear();
     return true;
 }