Przeglądaj źródła

Merge branch 'develop'

master^2
Guillaume 3 lat temu
rodzic
commit
fef87c6dd7
2 zmienionych plików z 38 dodań i 36 usunięć
  1. +3
    -1
      ShopBundle/Controller/Backend/ProductFamilyController.php
  2. +35
    -35
      ShopBundle/Repository/ProductRepository.php

+ 3
- 1
ShopBundle/Controller/Backend/ProductFamilyController.php Wyświetl plik

@@ -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 Wyświetl plik

@@ -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();
}

}

Ładowanie…
Anuluj
Zapisz