Discutea / DForumBundle

Forum Bundle for symfony 3
28 stars 13 forks source link

Remove 'pinned' => false from dfLastTopicInForum #35

Closed Kodmit closed 6 years ago

Kodmit commented 6 years ago

This function cause crashes when you answer to a pinned post (idk if it's the same for everyone) Impossible to access an attribute ("poster") on a boolean variable ("").

So I have changed

public function dfLastTopicInForum(Forum $forum)
    {
        $topic = $this->em->getRepository('DForumBundle:Topic')->findOneBy(
            array('forum' => $forum, 'pinned' => false),
            array('lastPost' => 'DESC'));
        return $topic;
    }

To

public function dfLastTopicInForum(Forum $forum)
    {
        $topic = $this->em->getRepository('DForumBundle:Topic')->findOneBy(
            array('forum' => $forum),
            array('lastPost' => 'DESC'));
        return $topic;
    }

And now it's work fine.