Browse Source

Merge branch 'develop'

master
Fab 2 years ago
parent
commit
729c7cd00c
5 changed files with 21 additions and 27 deletions
  1. +8
    -7
      Controller/AdminControllerTrait.php
  2. +2
    -2
      EventSubscriber/Address/DuplicateAddressEventSubscriber.php
  3. +0
    -17
      Repository/Product/ProductFamilyStore.php
  4. +1
    -1
      Solver/Order/OrderShopSolver.php
  5. +10
    -0
      Solver/Product/ProductFamilySolver.php

+ 8
- 7
Controller/AdminControllerTrait.php View File



if ($duplicateOtherMerchantForm->isSubmitted() && $duplicateOtherMerchantForm->isValid()) { if ($duplicateOtherMerchantForm->isSubmitted() && $duplicateOtherMerchantForm->isValid()) {
$newEntity = $entityComponent->duplicateEntity($context->getEntity()->getInstance()); $newEntity = $entityComponent->duplicateEntity($context->getEntity()->getInstance());
$entityManager->create($newEntity);
$merchant = $duplicateOtherMerchantForm->get('merchants')->getData();


$merchant = $duplicateOtherMerchantForm->get('merchants')->getData();
//
if($this->isInstanceOf(ProductFamilyInterface::class)) { if($this->isInstanceOf(ProductFamilyInterface::class)) {
$sectionStore = $this->getSectionContainer()->getStore()->setMerchant($merchant); $sectionStore = $this->getSectionContainer()->getStore()->setMerchant($merchant);


} }


$newEntity->initProductCategories(); $newEntity->initProductCategories();
}
}
else { else {
$newEntity->setMerchant($merchant); $newEntity->setMerchant($merchant);
} }

$entityManager->update($newEntity);
//
//
$entityManager->create($newEntity, false);
$entityManager->flush(); $entityManager->flush();


$url = $this->get(AdminUrlGenerator::class) $url = $this->get(AdminUrlGenerator::class)


if ($duplicateOtherSectionForm->isSubmitted() && $duplicateOtherSectionForm->isValid()) { if ($duplicateOtherSectionForm->isSubmitted() && $duplicateOtherSectionForm->isValid()) {
$newEntity = $entityComponent->duplicateEntity($context->getEntity()->getInstance()); $newEntity = $entityComponent->duplicateEntity($context->getEntity()->getInstance());
$em->create($newEntity);
$em->create($newEntity, false);
$section = $duplicateOtherSectionForm->get('sections')->getData(); $section = $duplicateOtherSectionForm->get('sections')->getData();
$newEntity->setSection($section); $newEntity->setSection($section);
$em->update($newEntity);
$em->update($newEntity, false);
$em->flush(); $em->flush();


$url = $this->get(AdminUrlGenerator::class) $url = $this->get(AdminUrlGenerator::class)

+ 2
- 2
EventSubscriber/Address/DuplicateAddressEventSubscriber.php View File

if(method_exists($entity, $methodGet) && method_exists($entity, $methodSet)){ if(method_exists($entity, $methodGet) && method_exists($entity, $methodSet)){
$newAddress = clone $entity->$methodGet(); $newAddress = clone $entity->$methodGet();
$entity->$methodSet($newAddress); $entity->$methodSet($newAddress);
$this->em->persist($newAddress);
$this->em->create($newAddress, false);
} }
} }


} }




}
}

+ 0
- 17
Repository/Product/ProductFamilyStore.php View File

return $query; return $query;
} }


public function isReductionCatalogDisplayed(ProductFamilyInterface $productFamily): bool
{
//TODO à discuter
// $reductionCatalog = $this->reductionCatalogStore->setMerchant($this->merchant)
// ->getByProductFamily($productFamily);

return $this->hasReductionCatalog($productFamily) && $productFamily->getReductionCatalog()->isDisplayed();
}

public function hasReductionCatalog(ProductFamilyInterface $productFamily): bool
{
$reductionCatalog = $this->reductionCatalogStore->setMerchant($this->merchant)
->getByProductFamily($productFamily);

return (bool)$productFamily->getReductionCatalog();
}

public function getByParentCategory( public function getByParentCategory(
ProductCategoryInterface $parentCategory, ProductCategoryInterface $parentCategory,
$user = null, $user = null,

+ 1
- 1
Solver/Order/OrderShopSolver.php View File

OrderShopInterface $orderShop, OrderShopInterface $orderShop,
ProductInterface $product, ProductInterface $product,
$byWeight = false $byWeight = false
): int {
): float {
$quantity = 0; $quantity = 0;
$productFamily = $product->getProductFamily(); $productFamily = $product->getProductFamily();
$behaviorCountStock = $productFamily->getBehaviorCountStock(); $behaviorCountStock = $productFamily->getBehaviorCountStock();

+ 10
- 0
Solver/Product/ProductFamilySolver.php View File



return $title; return $title;
} }

public function isReductionCatalogDisplayed(ProductFamilyInterface $productFamily): bool
{
return $this->hasReductionCatalog($productFamily) && $productFamily->getReductionCatalog()->isDisplayed();
}

public function hasReductionCatalog(ProductFamilyInterface $productFamily): bool
{
return (bool)$productFamily->getReductionCatalog();
}
} }



Loading…
Cancel
Save