|
- <?php
-
- namespace Lc\CaracoleBundle\Repository\File;
-
- use Knp\Component\Pager\PaginatorInterface;
- use Lc\CaracoleBundle\Model\Address\AddressInterface;
- use Lc\CaracoleBundle\Repository\MerchantRepositoryQueryTrait;
- use Lc\CaracoleBundle\Repository\SectionRepositoryQueryTrait;
- use Lc\SovBundle\Repository\AbstractRepositoryQuery;
-
- class DocumentRepositoryQuery extends AbstractRepositoryQuery
- {
- use MerchantRepositoryQueryTrait;
-
- public function __construct(DocumentRepository $repository, PaginatorInterface $paginator)
- {
- parent::__construct($repository, 'document', $paginator);
- }
-
- public function filterByType($type)
- {
- return $this->andWhereEqual('type', $type);
- }
-
- public function filterByBuyerAddress(AddressInterface $buyerAddress)
- {
- return $this
- ->andWhere('.buyerAddress = :buyerAddress')
- ->setParameter('buyerAddress', $buyerAddress);
- }
-
- public function filterByReference(string $reference = null)
- {
- if(is_null($reference)) {
- return $this->andWhere('.reference IS NULL');
- }
- else {
- return $this
- ->andWhere('.reference LIKE :reference')
- ->setParameter('reference', $reference);
- }
- }
-
- public function filterIsReferenceNotNull()
- {
- return $this->andWhere('.reference IS NOT NULL');
- }
- }
|