Linux SRV-16 6.18.44-paas #1 SMP PREEMPT_DYNAMIC Thu Aug 13 10:08:12 UTC 2026 x86_64
/
srv
/
data
/
trash
/
vhost_www.rec-app.app_1716798588
/
htdocs
/
src
/
Repository
/
//srv/data/trash/vhost_www.rec-app.app_1716798588/htdocs/src/Repository/NewsRepository.php
<?php namespace App\Repository; use App\Entity\News; use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository; use Doctrine\Persistence\ManagerRegistry; /** * @extends ServiceEntityRepository<News> * * @method News|null find($id, $lockMode = null, $lockVersion = null) * @method News|null findOneBy(array $criteria, array $orderBy = null) * @method News[] findAll() * @method News[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null) */ class NewsRepository extends ServiceEntityRepository { public function __construct(ManagerRegistry $registry) { parent::__construct($registry, News::class); } public function add(News $entity, bool $flush = false): void { $this->getEntityManager()->persist($entity); if ($flush) { $this->getEntityManager()->flush(); } } public function remove(News $entity, bool $flush = false): void { $this->getEntityManager()->remove($entity); if ($flush) { $this->getEntityManager()->flush(); } } /** * @return News[] Returns an array of PhoneModel objects */ public function findLastFiveAdded() { return $this->createQueryBuilder('n') ->orderBy('n.id', 'DESC') ->setMaxResults(5) ->getQuery() ->getResult(); } }