Browse Source

Frontend : actualités (list, view)

reduction
Guillaume 4 years ago
parent
commit
f8b68ae78c
1 changed files with 9 additions and 6 deletions
  1. +9
    -6
      ShopBundle/Repository/NewsRepository.php

+ 9
- 6
ShopBundle/Repository/NewsRepository.php View File

@@ -19,12 +19,15 @@ class NewsRepository extends BaseRepository implements DefaultRepositoryInterfac
return NewsInterface::class;
}

public function findLastNewsHome()
public function findLatests($maxResults = 0)
{
return $this->findByMerchantQuery()
->orderBy('e.date', 'DESC')
->setMaxResults(2)
->getQuery()
->getResult();
$result = $this->findByMerchantQuery()
->orderBy('e.date', 'DESC') ;

if($maxResults) {
$result->setMaxResults($maxResults) ;
}

return $result->getQuery()->getResult() ;
}
}

Loading…
Cancel
Save