Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

DocumentRepositoryQuery.php 1.4KB

il y a 3 ans
il y a 3 ans
il y a 3 ans
il y a 2 ans
il y a 3 ans
il y a 3 ans
il y a 3 ans
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <?php
  2. namespace Lc\CaracoleBundle\Repository\File;
  3. use Knp\Component\Pager\PaginatorInterface;
  4. use Lc\CaracoleBundle\Model\Address\AddressInterface;
  5. use Lc\CaracoleBundle\Repository\MerchantRepositoryQueryTrait;
  6. use Lc\CaracoleBundle\Repository\SectionRepositoryQueryTrait;
  7. use Lc\SovBundle\Repository\AbstractRepositoryQuery;
  8. class DocumentRepositoryQuery extends AbstractRepositoryQuery
  9. {
  10. use MerchantRepositoryQueryTrait;
  11. public function __construct(DocumentRepository $repository, PaginatorInterface $paginator)
  12. {
  13. parent::__construct($repository, 'document', $paginator);
  14. }
  15. public function filterByType($type)
  16. {
  17. return $this->andWhereEqual('type', $type);
  18. }
  19. public function filterByBuyerAddress(AddressInterface $buyerAddress)
  20. {
  21. return $this
  22. ->andWhere('.buyerAddress = :buyerAddress')
  23. ->setParameter('buyerAddress', $buyerAddress);
  24. }
  25. public function filterByReference(string $reference = null)
  26. {
  27. if(is_null($reference)) {
  28. return $this->andWhere('.reference IS NULL');
  29. }
  30. else {
  31. return $this
  32. ->andWhere('.reference LIKE :reference')
  33. ->setParameter('reference', $reference);
  34. }
  35. }
  36. public function filterIsReferenceNotNull()
  37. {
  38. return $this->andWhere('.reference IS NOT NULL');
  39. }
  40. }