|
- <?php
-
- namespace Lc\ShopBundle\Repository;
-
- use App\Entity\MerchantConfig;
- use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
- use Doctrine\Common\Persistence\ManagerRegistry;
- use Doctrine\ORM\EntityManager;
- use Lc\ShopBundle\Context\MerchantConfigInterface;
- use Lc\ShopBundle\Repository\BaseRepository;
- use Symfony\Component\Security\Core\Security;
-
- /**
- * @method MerchantConfig|null find($id, $lockMode = null, $lockVersion = null)
- * @method MerchantConfig|null findOneBy(array $criteria, array $orderBy = null)
- * @method MerchantConfig[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
- */
- class MerchantConfigRepository extends BaseRepository
- {
- protected $security ;
-
- public function __construct(EntityManager $entityManager, Security $security)
- {
- $this->security = $security ;
- parent::__construct($entityManager, MerchantConfigInterface::class);
- }
-
- public function findAll()
- {
- return $this->createQueryBuilder('m')
- ->andWhere('m.merchant = :currentMerchant')
- ->setParameter('currentMerchant', $this->security->getUser()->getMerchant()->getId())
- ->getQuery()
- ->getResult();
- }
-
- // /**
- // * @return MerchantConfig[] Returns an array of MerchantConfig objects
- // */
- /*
- public function findByExampleField($value)
- {
- return $this->createQueryBuilder('m')
- ->andWhere('m.exampleField = :val')
- ->setParameter('val', $value)
- ->orderBy('m.id', 'ASC')
- ->setMaxResults(10)
- ->getQuery()
- ->getResult()
- ;
- }
- */
-
- /*
- public function findOneBySomeField($value): ?MerchantConfig
- {
- return $this->createQueryBuilder('m')
- ->andWhere('m.exampleField = :val')
- ->setParameter('val', $value)
- ->getQuery()
- ->getOneOrNullResult()
- ;
- }
- */
- }
|