ソースを参照

Intégration app order

packProduct
Fab 3年前
コミット
cf3c41ffb4
8個のファイルの変更56行の追加37行の削除
  1. +14
    -15
      Controller/AdminControllerTrait.php
  2. +2
    -2
      Controller/Setting/SettingAdminController.php
  3. +4
    -7
      Controller/User/UserMerchantAdminController.php
  4. +5
    -1
      Factory/Order/OrderProductFactory.php
  5. +26
    -9
      Field/AssociationField.php
  6. +1
    -1
      Repository/Product/ProductRepositoryQuery.php
  7. +1
    -0
      Repository/Product/ProductStore.php
  8. +3
    -2
      Solver/Price/OrderProductPriceSolver.php

+ 14
- 15
Controller/AdminControllerTrait.php ファイルの表示

@@ -67,7 +67,7 @@ trait AdminControllerTrait
parent::getSubscribedServices(),
[
MerchantResolver::class => MerchantResolver::class,
SectionResolver::class=> SectionResolver::class,
SectionResolver::class => SectionResolver::class,
AddressContainer::class => AddressContainer::class,
TaxRateContainer::class => TaxRateContainer::class,
UnitContainer::class => UnitContainer::class,
@@ -192,13 +192,11 @@ trait AdminControllerTrait
->setAction(Action::EDIT)
->setEntityId($newEntity->getId())
->generateUrl();
$this->addFlash(
$this->addFlashTranslator(
'success',
$translatorAdmin->transFlashMessage(
'duplicateToOtherMerchant',
['%merchant%' => $merchant->getTitle()]
),
array()
'duplicateToOtherMerchant',
$this->getTranslationEntityName(),
['%merchant%' => $merchant->getTitle()]
);

//TODO switch merchant route
@@ -265,13 +263,11 @@ trait AdminControllerTrait
->setAction(Action::EDIT)
->setEntityId($newEntity->getId())
->generateUrl();
$this->addFlash(
$this->addFlashTranslator(
'success',
$translatorAdmin->transFlashMessage(
'duplicateToOtherSection',
['%section%' => $section->getTitle()]
),
array()
'duplicateToOtherSection',
$this->getTranslationEntityName(),
['%section%' => $section->getTitle()]
);

//TODO switch merchant route
@@ -331,10 +327,13 @@ trait AdminControllerTrait
return $duplicateAction;
}

public function getCurrentSection(){
public function getCurrentSection()
{
return $this->get(SectionResolver::class)->getCurrent();
}
public function getCurrentMerchant(){

public function getCurrentMerchant()
{
return $this->get(MerchantResolver::class)->getCurrent();
}
}

+ 2
- 2
Controller/Setting/SettingAdminController.php ファイルの表示

@@ -68,7 +68,7 @@ class SettingAdminController extends SovSettingController
$entityManager->update($entity);
$entityManager->flush();

$this->addFlash('success', $this->getTranslatorAdmin()->transFlashMessage('settings_saved'));
$this->addFlashTranslator('success','updated');
}

return $this->render(
@@ -98,7 +98,7 @@ class SettingAdminController extends SovSettingController
$entityManager->update($site);
$entityManager->flush();

$this->addFlash('success', $this->getTranslatorAdmin()->transFlashMessage('settings_saved'));
$this->addFlashTranslator('success','updated');
}

return $this->render(

+ 4
- 7
Controller/User/UserMerchantAdminController.php ファイルの表示

@@ -144,7 +144,7 @@ abstract class UserMerchantAdminController extends AbstractAdminController
$userMerchant->setUser($user);
$entityManager->create($userMerchant);
$entityManager->flush();
$this->addFlash('success', $this->get(TranslatorAdmin::class)->trans('form.user_merchant.create'));
$this->addFlashTranslator('success','created');
$url = $this->get(AdminUrlGenerator::class)->setAction(Action::INDEX)->generateUrl();

return $this->redirect($url);
@@ -156,15 +156,12 @@ abstract class UserMerchantAdminController extends AbstractAdminController
$entityManager->create($userMerchant);
$entityManager->flush();

$this->addFlash('success', $this->get(TranslatorAdmin::class)->trans('form.user_merchant.linked'));
$this->addFlashTranslator('success', 'linked');
$url = $this->get(AdminUrlGenerator::class)->setAction(Action::INDEX)->generateUrl();

return $this->redirect($url);
} else {
$this->addFlash(
'error',
$this->get(TranslatorAdmin::class)->trans('form.user_merchant.already_exist')
);
$this->addFlashTranslator('error','already_exist');
}
}
}
@@ -198,7 +195,7 @@ abstract class UserMerchantAdminController extends AbstractAdminController
$entityManager->update($userMerchant);
$entityManager->update($userMerchant->getUser());
$entityManager->flush();
$this->addFlash('success', $this->get(TranslatorAdmin::class)->trans('form.user_merchant.update'));
$this->addFlashTranslator('success', 'updated');
$url = $this->get(AdminUrlGenerator::class)->setAction(Action::INDEX)->generateUrl();

return $this->redirect($url);

+ 5
- 1
Factory/Order/OrderProductFactory.php ファイルの表示

@@ -11,7 +11,7 @@ class OrderProductFactory extends AbstractFactory
{
public function create(ProductInterface $product, int $quantityOrder): OrderProductInterface
{
$orderProduct = new OrderProduct();
$orderProduct = $this->createBase();

$orderProduct->setProduct($product);
$orderProduct->setQuantityOrder($quantityOrder);
@@ -19,4 +19,8 @@ class OrderProductFactory extends AbstractFactory
return $orderProduct;
}

public function createBase(){
return new OrderProduct();
}

}

+ 26
- 9
Field/AssociationField.php ファイルの表示

@@ -85,14 +85,25 @@ final class AssociationField implements FieldInterface
return $this;
}

public function setLeftJoin($entityName): self{
public function setLeftJoin($entityName): self
{
$this->queryBuilderParameters['leftJoin'][] = $entityName;

return $this;
}

public function addAndWhere($whereClause, $parameter): self
{
$this->queryBuilderParameters['leftJoin'][] = [
'whereClause' => $whereClause,
'parameter' => $parameter
];

return $this;
}

public function addOrderBy($field, $direction ='ASC') : self

public function addOrderBy($field, $direction = 'ASC'): self
{
$this->queryBuilderParameters['orderBy'][] = $field;
$this->queryBuilderParameters['orderByDirection'][] = $direction;
@@ -108,14 +119,14 @@ final class AssociationField implements FieldInterface
function (EntityRepository $er) use ($param) {
$qb = $er->createQueryBuilder('e');
if (isset($param['section'])) {
$qb->andWhereSection('e',$param['section']);
$qb->andWhereSection('e', $param['section']);
}
if (isset($param['merchant'])) {
$qb->andWhereMerchant('e',$param['merchant']);
$qb->andWhereMerchant('e', $param['merchant']);
}

if (isset($param['merchantManyToMany'])) {
$qb->andWhereMerchantManyToMany('e',$param['merchantManyToMany']);
$qb->andWhereMerchantManyToMany('e', $param['merchantManyToMany']);
}

if (isset($param['status'])) {
@@ -123,14 +134,20 @@ final class AssociationField implements FieldInterface
}

if (isset($param['orderBy'])) {
foreach ($param['orderBy'] as $i=>$field) {
$qb->addOrderBy('e.'.$param['orderBy'][$i], $param['orderByDirection'][$i]);
foreach ($param['orderBy'] as $i => $field) {
$qb->addOrderBy('e.' . $param['orderBy'][$i], $param['orderByDirection'][$i]);
}
}

if (isset($param['leftJoin'])) {
foreach ($param['leftJoin'] as $i=>$entityName) {
$qb->leftJoin('e.'.$entityName, $entityName)->addSelect($entityName);
foreach ($param['leftJoin'] as $i => $entityName) {
$qb->leftJoin('e.' . $entityName, $entityName)->addSelect($entityName);
}
}

if (isset($param['andWhere'])) {
foreach ($param['andWhere'] as $i => $whereClause) {
$qb->andWhere($whereClause['whereClause'])->setParamater($whereClause['parameter']);
}
}


+ 1
- 1
Repository/Product/ProductRepositoryQuery.php ファイルの表示

@@ -11,7 +11,7 @@ use Lc\SovBundle\Repository\RepositoryQueryInterface;

class ProductRepositoryQuery extends AbstractRepositoryQuery
{
protected bool $isJoinProductFamily;
protected bool $isJoinProductFamily =false;

public function __construct(ProductRepository $repository, PaginatorInterface $paginator)
{

+ 1
- 0
Repository/Product/ProductStore.php ファイルの表示

@@ -26,6 +26,7 @@ class ProductStore extends AbstractStore
{
$query->filterIsOnlineAndOffline();
$query->filterBySection($this->section);
return $query;
}

public function relationsDefault($query):RepositoryQueryInterface

+ 3
- 2
Solver/Price/OrderProductPriceSolver.php ファイルの表示

@@ -116,9 +116,10 @@ class OrderProductPriceSolver

public function getTotalWithTax(OrderProductInterface $orderProduct)
{

return $this->applyTax(
$this->getTotal($orderProduct),
$orderProduct->getTaxRateInherited()->getValue()
$orderProduct->getTaxRate()->getValue()
);
}

@@ -136,7 +137,7 @@ class OrderProductPriceSolver
{
return $this->applyTax(
$this->getTotalBuyingPrice($orderProduct),
$orderProduct->getTaxRateInherited()->getValue()
$orderProduct->getTaxRate()->getValue()
);
}


読み込み中…
キャンセル
保存