|
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- <?php
-
- namespace Lc\CaracoleBundle\Repository;
-
- use Doctrine\Persistence\ManagerRegistry;
- use Lc\CaracoleBundle\Doctrine\Extension\FilterMerchantInterface;
- use Lc\CaracoleBundle\Doctrine\Extension\FilterSectionInterface;
- use Lc\CaracoleBundle\Resolver\MerchantResolver;
- use Lc\CaracoleBundle\Resolver\SectionResolver;
-
- // @TODO : à supprimer à terme, certainement
- trait RepositoryTrait
- {
- protected MerchantResolver $merchantResolver;
- protected SectionResolver $sectionResolver;
-
- public function __construct(
- ManagerRegistry $managerRegistry,
- SectionResolver $sectionResolver,
- MerchantResolver $merchantResolver
- ) {
- parent::__construct($managerRegistry);
- $this->merchantResolver = $merchantResolver;
- $this->sectionResolver = $sectionResolver;
- }
-
- /*protected function setCriteria(array $criteria) :array
- {
- $className = $this->getClassMetadata()->getName();
- $entity = new $className;
-
- if ($entity instanceof FilterMerchantInterface) {
- if (!isset($criteria['merchant'])) {
- $criteria['merchant'] = $this->merchantResolver->getCurrent();
- }
- if ($criteria['merchant'] === false) {
- unset($criteria['merchant']);
- }
- }
-
- if ($entity instanceof FilterSectionInterface) {
- if (!isset($criteria['section'])) {
- $criteria['section'] = $this->sectionResolver->getCurrent();
- }
- if ($criteria['section'] === false) {
- unset($criteria['section']);
- }
- }
- return $criteria;
- }*/
-
- }
|