Преглед на файлове

Connexion via prestashop

feature/export_comptable
Fab преди 4 години
родител
ревизия
eb806fdcbe
променени са 2 файла, в които са добавени 14 реда и са изтрити 0 реда
  1. +5
    -0
      ShopBundle/Form/Backend/ReductionCommon/UsersFilterType.php
  2. +9
    -0
      ShopBundle/Repository/UserRepository.php

+ 5
- 0
ShopBundle/Form/Backend/ReductionCommon/UsersFilterType.php Целия файл

@@ -4,6 +4,7 @@ namespace Lc\ShopBundle\Form\Backend\ReductionCommon;

use Doctrine\ORM\EntityManagerInterface;

use Doctrine\ORM\EntityRepository;
use Lc\ShopBundle\Context\ReductionCatalogInterface;
use Lc\ShopBundle\Context\UserInterface;
use Lc\ShopBundle\Repository\GroupUserRepository;
@@ -42,6 +43,10 @@ class UsersFilterType extends AbstractType
$builder->add('users', EntityType::class, [
'class' => $userClass->name,
'required' => false,
'query_builder'=> function (EntityRepository $er) {
$query = $er->findByMerchantQuery()->leftJoin('e.groupUsers', 'groupUsers')->addSelect('groupUsers');
return $query;
},
'expanded' => false,
'multiple' => true,
'translation_domain'=>'lcshop',

+ 9
- 0
ShopBundle/Repository/UserRepository.php Целия файл

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

namespace Lc\ShopBundle\Repository;

use Doctrine\ORM\QueryBuilder;
use Lc\ShopBundle\Context\DefaultRepositoryInterface;
use Lc\ShopBundle\Context\UserInterface;

@@ -18,6 +19,14 @@ class UserRepository extends BaseRepository implements DefaultRepositoryInterfac
return UserInterface::class;
}

public function findByMerchantQuery() :QueryBuilder
{
return $this->createQueryBuilder('e')
->innerJoin('e.userMerchants', "userMerchants")
->andWhere('userMerchants.merchant = :currentMerchant')
->setParameter('currentMerchant', $this->merchantUtils->getMerchantCurrent()->getId()) ;
}

public function findAllByNewsletter($newsletter)
{
return $this->createQueryBuilder('e')

Loading…
Отказ
Запис