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.

48 line
995B

  1. <?php
  2. namespace Lc\CaracoleBundle\Repository\File;
  3. use App\Entity\Address\Address;
  4. use Lc\CaracoleBundle\Repository\MerchantStoreTrait;
  5. use Lc\SovBundle\Repository\AbstractStore;
  6. class DocumentStore extends AbstractStore
  7. {
  8. use MerchantStoreTrait;
  9. protected DocumentRepositoryQuery $query;
  10. public function __construct(DocumentRepositoryQuery $query)
  11. {
  12. $this->query = $query;
  13. }
  14. public function getOneLatestByType(string $documentType)
  15. {
  16. // @TODO : à écrire
  17. }
  18. // findLastInvoice
  19. public function getOneLastInvoice()
  20. {
  21. $query = $this->query->create();
  22. $query
  23. ->filterByMerchant($this->merchant)
  24. ->orderBy('.createdAt', 'DESC');
  25. return $query->findOne();
  26. }
  27. public function getByBuyerAddress(Address $buyerAddress)
  28. {
  29. $query = $this->query->create();
  30. $query
  31. ->filterByBuyerAddress($buyerAddress);
  32. return $query->find();
  33. }
  34. }