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.

32 lines
1.1KB

  1. <?php
  2. namespace Lc\ShopBundle\Repository;
  3. use App\Entity\DocumentQuotation;
  4. use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
  5. use Doctrine\Common\Persistence\ManagerRegistry;
  6. use Lc\ShopBundle\Context\DefaultRepositoryInterface;
  7. use Lc\ShopBundle\Context\DocumentInterface;
  8. /**
  9. * @method Document|null find($id, $lockMode = null, $lockVersion = null)
  10. * @method Document|null findOneBy(array $criteria, array $orderBy = null)
  11. * @method Document[] findAll()
  12. * @method Document[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
  13. */
  14. class DocumentRepository extends BaseRepository implements DefaultRepositoryInterface
  15. {
  16. public function getInterfaceClass()
  17. {
  18. return DocumentInterface::class;
  19. }
  20. public function findLastInvoice()
  21. {
  22. $query = $this->findByMerchantQuery();
  23. $query->orderBy('e.createdAt', 'DESC');
  24. $query->setMaxResults(1);
  25. return $query->getQuery()->getOneOrNullResult();
  26. }
  27. }