소스 검색

Merge branch 'develop'

master^2
Guillaume 3 년 전
부모
커밋
fef87c6dd7
2개의 변경된 파일38개의 추가작업 그리고 36개의 파일을 삭제
  1. +3
    -1
      ShopBundle/Controller/Backend/ProductFamilyController.php
  2. +35
    -35
      ShopBundle/Repository/ProductRepository.php

+ 3
- 1
ShopBundle/Controller/Backend/ProductFamilyController.php 파일 보기

@@ -2,8 +2,10 @@

namespace Lc\ShopBundle\Controller\Backend;

use App\Entity\DepositoryZone;
use App\Entity\Product;
use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\EntityRepository;
use EasyCorp\Bundle\EasyAdminBundle\Event\EasyAdminEvents;
use FOS\UserBundle\Model\UserManagerInterface;
use Lc\ShopBundle\Context\ImageInterface;
@@ -19,6 +21,7 @@ use Lc\ShopBundle\Form\Backend\ProductFamily\ProductType;
use Lc\ShopBundle\Model\ProductFamily;
use Lc\ShopBundle\Services\UtilsManager;
use Mailjet\MailjetSwiftMailer\SwiftMailer\MailjetTransport;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\Extension\Core\Type\CollectionType;
use Symfony\Component\Form\Extension\Core\Type\HiddenType;
@@ -183,7 +186,6 @@ class ProductFamilyController extends AdminController
'required' => false
));


$formBuilder->add('products', CollectionType::class, array(
'label' => 'Déclinaisons',
'entry_type' => ProductType::class,

+ 35
- 35
ShopBundle/Repository/ProductRepository.php 파일 보기

@@ -14,42 +14,42 @@ use Lc\ShopBundle\Model\ProductFamily;
*/
class ProductRepository extends BaseRepository implements DefaultRepositoryInterface
{
public function getInterfaceClass()
{
return ProductInterface::class;
}


public function findProductByAvailabilitiesNegative()
{
$qb = $this->createQueryBuilder('e');
$qb->innerJoin('e.productFamily', 'productFamily');
$qb->addSelect('productFamily');
$qb->where('productFamily.merchant = :currentMerchant');
$qb->andWhere('productFamily.status = 1');
$qb->setParameter('currentMerchant', $this->merchantUtils->getMerchantCurrent()->getId());

$qb->andWhere(
$qb->expr()->orX(
$qb->expr()->andX(
$qb->expr()->orX(
'productFamily.behaviorCountStock LIKE :behaviorCountStockByProductFamily',
'productFamily.behaviorCountStock LIKE :behaviorCountStockByMeasure'
),
'productFamily.availableQuantity < 0 '
public function getInterfaceClass()
{
return ProductInterface::class;
}


public function findProductByAvailabilitiesNegative()
{
$qb = $this->createQueryBuilder('e');
$qb->innerJoin('e.productFamily', 'productFamily');
$qb->addSelect('productFamily');
$qb->where('productFamily.merchant = :currentMerchant');
$qb->setParameter('currentMerchant', $this->merchantUtils->getMerchantCurrent()->getId());
$qb->andWhere('productFamily.status = 1');

$qb->andWhere(
$qb->expr()->orX(
$qb->expr()->andX(
$qb->expr()->orX(
'productFamily.behaviorCountStock LIKE :behaviorCountStockByProductFamily',
'productFamily.behaviorCountStock LIKE :behaviorCountStockByMeasure'
),
$qb->expr()->andX(
'productFamily.behaviorCountStock LIKE :behaviorCountStockByProduct',
'e.availableQuantity < 0 '
)
'productFamily.availableQuantity < 0 '
),
$qb->expr()->andX(
'productFamily.behaviorCountStock LIKE :behaviorCountStockByProduct',
'e.availableQuantity < 0 '
)
);
$qb->setParameter('behaviorCountStockByProductFamily', ProductFamily::BEHAVIOR_COUNT_STOCK_BY_PRODUCT_FAMILY);
$qb->setParameter('behaviorCountStockByMeasure', ProductFamily::BEHAVIOR_COUNT_STOCK_BY_MEASURE);
$qb->setParameter('behaviorCountStockByProduct', ProductFamily::BEHAVIOR_COUNT_STOCK_BY_PRODUCT);
$qb->groupBy('productFamily.id');

return $qb->getQuery()->getResult();
}
)
);
$qb->setParameter('behaviorCountStockByProductFamily', ProductFamily::BEHAVIOR_COUNT_STOCK_BY_PRODUCT_FAMILY);
$qb->setParameter('behaviorCountStockByMeasure', ProductFamily::BEHAVIOR_COUNT_STOCK_BY_MEASURE);
$qb->setParameter('behaviorCountStockByProduct', ProductFamily::BEHAVIOR_COUNT_STOCK_BY_PRODUCT);
$qb->groupBy('productFamily.id');

return $qb->getQuery()->getResult();
}

}

Loading…
취소
저장