|
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364 |
- <?php
-
- namespace Lc\CaracoleBundle\Repository\File;
-
- use App\Entity\Address\Address;
- use Lc\CaracoleBundle\Repository\MerchantStoreTrait;
- use Lc\CaracoleBundle\Repository\SectionStoreTrait;
- use Lc\SovBundle\Repository\AbstractStore;
- use Lc\SovBundle\Repository\RepositoryQueryInterface;
-
- class DocumentStore extends AbstractStore
- {
- use SectionStoreTrait;
-
- protected DocumentRepositoryQuery $query;
-
- public function __construct(DocumentRepositoryQuery $query)
- {
- $this->query = $query;
- }
-
- public function orderByDefault(RepositoryQueryInterface $query): RepositoryQueryInterface
- {
- $query->orderBy('id');
- return $query;
- }
-
- public function filtersDefault(RepositoryQueryInterface $query): RepositoryQueryInterface
- {
- $query->filterIsOnlineAndOffline();
- $query->filterBySection($this->section);
- return $query;
- }
-
- public function relationsDefault(RepositoryQueryInterface $query): RepositoryQueryInterface
- {
- return $query;
- }
-
-
- public function getOneLatestByType(string $documentType, $query = null)
- {
- // @TODO : à écrire
- }
-
- // findLastInvoice
- public function getOneLastInvoice($query = null)
- {
- $query = $this->createDefaultQuery($query);
-
- $query
- ->orderBy('createdAt', 'DESC');
-
- return $query->findOne();
- }
-
- public function getByBuyerAddress(Address $buyerAddress, $query = null)
- {
- $query = $this->createDefaultQuery($query);
- $query->filterByBuyerAddress($buyerAddress);
- return $query->find();
- }
-
- }
|