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.

BaseRepository.php 1.0KB

123456789101112131415161718192021222324252627282930313233343536
  1. <?php
  2. namespace Lc\ShopBundle\Repository;
  3. use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepositoryInterface;
  4. use Doctrine\ORM\EntityManager;
  5. use Doctrine\ORM\EntityRepository;
  6. use Doctrine\ORM\QueryBuilder;
  7. use Symfony\Bridge\Doctrine\ManagerRegistry;
  8. use Symfony\Component\Form\Exception\LogicException;
  9. class BaseRepository extends EntityRepository implements ServiceEntityRepositoryInterface
  10. {
  11. /**
  12. * @param string $entityClass The class name of the entity this repository manages
  13. */
  14. public function __construct(EntityManager $entityManager, $entityClass)
  15. {
  16. parent::__construct($entityManager, $entityManager->getClassMetadata($entityClass));
  17. }
  18. public function findAllOfflineAndDelete()
  19. {
  20. return $this->createQueryBuilder('e')
  21. ->andWhere('e.status < = 0')
  22. ->orderBy('e.status', "DESC")
  23. ->getQuery()
  24. ->getResult();
  25. }
  26. }