app/Plugin/Topics42/Repository/TopicsRepository.php line 30

Open in your IDE?
  1. <?php
  2. namespace Plugin\Topics42\Repository;
  3. use Eccube\Repository\AbstractRepository;
  4. use Doctrine\Persistence\ManagerRegistry as RegistryInterface;
  5. use Eccube\Entity\News;
  6. use Doctrine\Common\Collections\ArrayCollection;
  7. use Doctrine\Common\Collections\Criteria;
  8. /**
  9.  * CampaignRepository.
  10.  *
  11.  * This class was generated by the Doctrine ORM. Add your own custom
  12.  * repository methods below.
  13.  */
  14. class TopicsRepository extends AbstractRepository
  15. {
  16.     /**
  17.      * CouponRepository constructor.
  18.      *
  19.      * @param RegistryInterface $registry
  20.      */
  21.     public function __construct(RegistryInterface $registry)
  22.     {
  23.         parent::__construct($registryNews::class);
  24.     }
  25.     public function getDispNewsAll(){
  26.         // second level cacheを効かせるためfindByで取得
  27.         $Results $this->findBy(['visible' => true], ['publish_date' => 'DESC''id' => 'DESC']);
  28.         // 公開日時前のNewsをフィルター
  29.         $criteria Criteria::create();
  30.         $criteria->where(Criteria::expr()->lte('publish_date', new \DateTime()));
  31.         $News = new ArrayCollection($Results);
  32.         return $News->matching($criteria);
  33.     }
  34. }