Fixed inability to feature a post on empty db

This commit is contained in:
Marcin Kurczewski 2014-11-09 21:28:49 +01:00
parent d4f245e414
commit 99845af35b

View file

@ -69,7 +69,7 @@ class PostFeatureService
{
$previousFeaturedPost = $this->getFeaturedPost();
if ($previousFeaturedPost->getId() !== $post->getId())
if (($previousFeaturedPost === null) or ($previousFeaturedPost->getId() !== $post->getId()))
{
$post->setLastFeatureTime($this->timeService->getCurrentTime());
$post->setFeatureCount($post->getFeatureCount() + 1);