public function create($owner, Topic $topic, $content, $isSticky = false) { $entity = new Post(); $entity->setContent($content); $entity->setUserId($owner); $entity->setTopic($topic); $entity->setIsSticky($isSticky); $entityManager = $this->getEntityManager(); $entityManager->persist($entity); $entityManager->flush(); return $entity; }