You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

NewsRepository.php 922B

123456789101112131415161718192021222324252627282930
  1. <?php
  2. namespace Lc\ShopBundle\Repository;
  3. use App\Entity\News;
  4. use Lc\ShopBundle\Context\DefaultRepositoryInterface;
  5. use Lc\ShopBundle\Context\NewsInterface;
  6. /**
  7. * @method News|null find($id, $lockMode = null, $lockVersion = null)
  8. * @method News|null findOneBy(array $criteria, array $orderBy = null)
  9. * @method News[] findAll()
  10. * @method News[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
  11. */
  12. class NewsRepository extends BaseRepository implements DefaultRepositoryInterface
  13. {
  14. public function getInterfaceClass()
  15. {
  16. return NewsInterface::class;
  17. }
  18. public function findLastNewsHome()
  19. {
  20. return $this->findByMerchantQuery()
  21. ->orderBy('e.date', 'DESC')
  22. ->setMaxResults(2)
  23. ->getQuery()
  24. ->getResult();
  25. }
  26. }