Skip to content

Commit

Permalink
Hides unpublished article in feed
Browse files Browse the repository at this point in the history
  • Loading branch information
sanpii authored and lenybernard committed Mar 2, 2019
1 parent 54e6086 commit fb30a69
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Bundle/BlogBundle/Entity/Blog.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\ORM\Mapping as ORM;
use Victoire\Bundle\PageBundle\Entity\Page;
use Victoire\Bundle\PageBundle\Entity\PageStatus;

/**
* PostPage.
Expand Down Expand Up @@ -74,7 +75,8 @@ public function getArticles()
public function getPublishedArticles()
{
return $this->articles->filter(function (Article $article) {
return $article->getPublishedAt() <= new \DateTime();
return $article->getStatus() === PageStatus::PUBLISHED
&& $article->getPublishedAt() <= new \DateTime();
});
}

Expand Down

0 comments on commit fb30a69

Please sign in to comment.