Pārlūkot izejas kodu

Refactoring services

packProduct
Guillaume pirms 3 gadiem
vecāks
revīzija
0c55186e6f
2 mainītis faili ar 21 papildinājumiem un 1 dzēšanām
  1. +8
    -0
      Repository/File/DocumentRepositoryQuery.php
  2. +13
    -1
      Repository/File/DocumentStore.php

+ 8
- 0
Repository/File/DocumentRepositoryQuery.php Parādīt failu

@@ -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 Parādīt failu

@@ -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();
}

}

Notiek ielāde…
Atcelt
Saglabāt