|
1234567891011121314151617181920212223242526272829303132333435 |
- <?php
-
- namespace Lc\ShopBundle\Repository;
-
- use App\Entity\News;
- use Lc\ShopBundle\Context\DefaultRepositoryInterface;
- use Lc\ShopBundle\Context\NewsInterface;
-
- /**
- * @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 BaseRepository implements DefaultRepositoryInterface
- {
- public function getInterfaceClass()
- {
- return NewsInterface::class;
- }
-
- public function findLatests($maxResults = 0)
- {
- $result = $this->findByMerchantQuery()
- ->orderBy('e.date', 'DESC') ;
-
- $result->andWhere('e.status = 1') ;
-
- if($maxResults) {
- $result->setMaxResults($maxResults) ;
- }
-
- return $result->getQuery()->getResult() ;
- }
- }
|