Browse Source

Refactoring services

packProduct
Guillaume 3 years ago
parent
commit
0c55186e6f
2 changed files with 21 additions and 1 deletions
  1. +8
    -0
      Repository/File/DocumentRepositoryQuery.php
  2. +13
    -1
      Repository/File/DocumentStore.php

+ 8
- 0
Repository/File/DocumentRepositoryQuery.php View File

@@ -3,6 +3,7 @@
namespace Lc\CaracoleBundle\Repository\File;

use Knp\Component\Pager\PaginatorInterface;
use Lc\CaracoleBundle\Model\Address\AddressInterface;
use Lc\CaracoleBundle\Repository\MerchantRepositoryQueryTrait;
use Lc\SovBundle\Repository\AbstractRepositoryQuery;

@@ -14,4 +15,11 @@ class DocumentRepositoryQuery extends AbstractRepositoryQuery
{
parent::__construct($repository, 'r', $paginator);
}

public function filterByBuyerAddress(AddressInterface $buyerAddress)
{
return $this
->andWhere('.buyerAddress = :buyerAddress')
->setParameter('buyerAddress', $buyerAddress);
}
}

+ 13
- 1
Repository/File/DocumentStore.php View File

@@ -2,6 +2,7 @@

namespace Lc\CaracoleBundle\Repository\File;

use App\Entity\Address\Address;
use Lc\CaracoleBundle\Repository\MerchantStoreTrait;
use Lc\SovBundle\Repository\AbstractStore;

@@ -21,7 +22,7 @@ class DocumentStore extends AbstractStore
// @TODO : à écrire
}

//findLastInvoice
// findLastInvoice
public function getOneLastInvoice()
{
$query = $this->query->create();
@@ -32,4 +33,15 @@ class DocumentStore extends AbstractStore

return $query->findOne();
}

public function getByBuyerAddress(Address $buyerAddress)
{
$query = $this->query->create();

$query
->filterByBuyerAddress($buyerAddress);

return $query->find();
}

}

Loading…
Cancel
Save