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.

DocumentStore.php 1.1KB

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