Przeglądaj źródła

Admin : createEntity

packProduct
Guillaume 3 lat temu
rodzic
commit
60b127e481
17 zmienionych plików z 142 dodań i 190 usunięć
  1. +5
    -1
      Controller/Order/OrderStatusAdminController.php
  2. +7
    -6
      Controller/Product/ProductCategoryAdminController.php
  3. +8
    -19
      Controller/Product/ProductFamilyAdminController.php
  4. +7
    -12
      Controller/Reduction/ReductionCartAdminController.php
  5. +7
    -15
      Controller/Reduction/ReductionCatalogAdminController.php
  6. +6
    -12
      Controller/Reduction/ReductionCreditAdminController.php
  7. +2
    -3
      Controller/Section/OpeningAdminController.php
  8. +8
    -16
      Controller/Section/SectionAdminController.php
  9. +4
    -6
      Controller/Site/NewsAdminController.php
  10. +3
    -7
      Controller/Site/PageAdminController.php
  11. +4
    -10
      Controller/Ticket/TicketAdminController.php
  12. +4
    -7
      Controller/User/GroupUserAdminController.php
  13. +57
    -59
      Controller/User/UserMerchantAdminController.php
  14. +7
    -4
      Factory/Product/ProductFamilyFactory.php
  15. +2
    -2
      Factory/Ticket/TicketFactory.php
  16. +9
    -3
      Factory/User/UserMerchantFactory.php
  17. +2
    -8
      Repository/Reduction/ReductionCatalogStore.php

+ 5
- 1
Controller/Order/OrderStatusAdminController.php Wyświetl plik

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

namespace Lc\CaracoleBundle\Controller\Order;


use Lc\CaracoleBundle\Container\Order\OrderStatusContainer;
use Lc\CaracoleBundle\Controller\AbstractAdminController;
use Lc\CaracoleBundle\Controller\AdminControllerTrait;
@@ -16,4 +15,9 @@ abstract class OrderStatusAdminController extends AbstractAdminController
{
return $this->get(OrderStatusContainer::class)->getRepositoryQuery();
}

public function createEntity(string $entityFqcn)
{
return $this->getOrderStatusContainer()->getFactory()->create();
}
}

+ 7
- 6
Controller/Product/ProductCategoryAdminController.php Wyświetl plik

@@ -8,9 +8,7 @@ use EasyCorp\Bundle\EasyAdminBundle\Field\IntegerField;
use EasyCorp\Bundle\EasyAdminBundle\Field\NumberField;
use EasyCorp\Bundle\EasyAdminBundle\Field\TextField;
use EasyCorp\Bundle\EasyAdminBundle\Field\DateTimeField;
use Lc\CaracoleBundle\Container\Product\ProductCategoryContainer;
use Lc\CaracoleBundle\Controller\AdminControllerTrait;
use Lc\SovBundle\Controller\AbstractAdminController;
use Lc\CaracoleBundle\Controller\AbstractAdminController;
use Lc\SovBundle\Field\CKEditorField;
use Lc\SovBundle\Field\StatusField;
use Lc\SovBundle\Field\ToggleField;
@@ -18,11 +16,14 @@ use Lc\SovBundle\Repository\RepositoryQueryInterface;

abstract class ProductCategoryAdminController extends AbstractAdminController
{
use AdminControllerTrait;

public function getRepositoryQuery() :RepositoryQueryInterface
{
return $this->get(ProductCategoryContainer::class)->getRepositoryQuery();
return $this->getProductCategoryContainer()->getRepositoryQuery();
}

public function createEntity(string $entityFqcn)
{
return $this->getProductCategoryContainer()->getFactory()->create($this->getSectionCurrent());
}

public function configureFields(string $pageName): iterable

+ 8
- 19
Controller/Product/ProductFamilyAdminController.php Wyświetl plik

@@ -2,41 +2,30 @@

namespace Lc\CaracoleBundle\Controller\Product;

use Doctrine\ORM\QueryBuilder;
use EasyCorp\Bundle\EasyAdminBundle\Collection\FieldCollection;
use EasyCorp\Bundle\EasyAdminBundle\Collection\FilterCollection;
use EasyCorp\Bundle\EasyAdminBundle\Config\KeyValueStore;
use EasyCorp\Bundle\EasyAdminBundle\Context\AdminContext;
use EasyCorp\Bundle\EasyAdminBundle\Dto\EntityDto;
use EasyCorp\Bundle\EasyAdminBundle\Dto\SearchDto;
use EasyCorp\Bundle\EasyAdminBundle\Field\AssociationField;
use EasyCorp\Bundle\EasyAdminBundle\Field\FormField;
use EasyCorp\Bundle\EasyAdminBundle\Field\NumberField;
use EasyCorp\Bundle\EasyAdminBundle\Field\TextField;
use Lc\CaracoleBundle\Container\Order\OrderShopContainer;
use Lc\CaracoleBundle\Container\Product\ProductFamilyContainer;
use Lc\CaracoleBundle\Controller\AdminControllerTrait;
use Lc\CaracoleBundle\Doctrine\Extension\FilterSectionInterface;
use Lc\CaracoleBundle\Field\Address\AddressField;
use Lc\CaracoleBundle\Controller\AbstractAdminController;
use Lc\CaracoleBundle\Resolver\SectionResolver;
use Lc\SovBundle\Controller\AbstractAdminController;
use Lc\SovBundle\Field\BooleanField;
use Lc\SovBundle\Field\CKEditorField;
use Lc\SovBundle\Field\StatusField;
use Lc\SovBundle\Repository\RepositoryQueryInterface;
use Symfony\Component\HttpFoundation\RequestStack;
use Symfony\Component\HttpFoundation\Response;

abstract class ProductFamilyAdminController extends AbstractAdminController
{
use AdminControllerTrait;


public function getRepositoryQuery() :RepositoryQueryInterface
{
return $this->get(ProductFamilyContainer::class)->getRepositoryQuery();
}

public function createEntity(string $entityFqcn)
{
return $this->getProductFamilyContainer()
->getFactory()
->create($this->getMerchantCurrent());
}

// public function createIndexQueryBuilder(SearchDto $searchDto, EntityDto $entityDto, FieldCollection $fields, FilterCollection $filters): QueryBuilder
// {
// $queryBuilder = parent::createIndexQueryBuilder($searchDto, $entityDto, $fields, $filters);

+ 7
- 12
Controller/Reduction/ReductionCartAdminController.php Wyświetl plik

@@ -2,26 +2,21 @@

namespace Lc\CaracoleBundle\Controller\Reduction;


use EasyCorp\Bundle\EasyAdminBundle\Field\ChoiceField;
use EasyCorp\Bundle\EasyAdminBundle\Field\NumberField;
use EasyCorp\Bundle\EasyAdminBundle\Field\TextField;
use Lc\CaracoleBundle\Container\Reduction\ReductionCartContainer;
use Lc\CaracoleBundle\Controller\AdminControllerTrait;
use Lc\CaracoleBundle\Model\Config\TaxRateModel;
use Lc\CaracoleBundle\Model\Config\UnitModel;
use Lc\SovBundle\Controller\AbstractAdminController;
use Lc\SovBundle\Repository\RepositoryQueryInterface;
use Lc\SovBundle\Translation\TranslatorAdmin;
use Lc\CaracoleBundle\Controller\AbstractAdminController;

abstract class ReductionCartAdminController extends AbstractAdminController
{
use AdminControllerTrait;


public function getRepositoryQuery() :RepositoryQueryInterface
{
return $this->get(ReductionCartContainer::class)->getRepositoryQuery();
return $this->getReductionCartContainer()->getRepositoryQuery();
}

public function createEntity(string $entityFqcn)
{
return $this->getReductionCartContainer()->getFactory()->create($this->getSectionCurrent());
}

}

+ 7
- 15
Controller/Reduction/ReductionCatalogAdminController.php Wyświetl plik

@@ -2,26 +2,18 @@

namespace Lc\CaracoleBundle\Controller\Reduction;


use EasyCorp\Bundle\EasyAdminBundle\Field\ChoiceField;
use EasyCorp\Bundle\EasyAdminBundle\Field\NumberField;
use EasyCorp\Bundle\EasyAdminBundle\Field\TextField;
use Lc\CaracoleBundle\Container\Reduction\ReductionCatalogContainer;
use Lc\CaracoleBundle\Controller\AdminControllerTrait;
use Lc\CaracoleBundle\Model\Config\TaxRateModel;
use Lc\CaracoleBundle\Model\Config\UnitModel;
use Lc\SovBundle\Controller\AbstractAdminController;
use Lc\CaracoleBundle\Controller\AbstractAdminController;
use Lc\SovBundle\Repository\RepositoryQueryInterface;
use Lc\SovBundle\Translation\TranslatorAdmin;

abstract class ReductionCatalogAdminController extends AbstractAdminController
{
use AdminControllerTrait;


public function getRepositoryQuery() :RepositoryQueryInterface
public function getRepositoryQuery(): RepositoryQueryInterface
{
return $this->get(ReductionCatalogContainer::class)->getRepositoryQuery();
return $this->getReductionCatalogContainer()->getRepositoryQuery();
}

public function createEntity(string $entityFqcn)
{
return $this->getReductionCatalogContainer()->getFactory()->create($this->getSectionCurrent());
}
}

+ 6
- 12
Controller/Reduction/ReductionCreditAdminController.php Wyświetl plik

@@ -2,25 +2,19 @@

namespace Lc\CaracoleBundle\Controller\Reduction;


use EasyCorp\Bundle\EasyAdminBundle\Field\ChoiceField;
use EasyCorp\Bundle\EasyAdminBundle\Field\NumberField;
use EasyCorp\Bundle\EasyAdminBundle\Field\TextField;
use Lc\CaracoleBundle\Container\Reduction\ReductionCreditContainer;
use Lc\CaracoleBundle\Controller\AdminControllerTrait;
use Lc\CaracoleBundle\Model\Config\TaxRateModel;
use Lc\CaracoleBundle\Model\Config\UnitModel;
use Lc\SovBundle\Controller\AbstractAdminController;
use Lc\CaracoleBundle\Controller\AbstractAdminController;
use Lc\SovBundle\Repository\RepositoryQueryInterface;
use Lc\SovBundle\Translation\TranslatorAdmin;

abstract class ReductionCreditAdminController extends AbstractAdminController
{
use AdminControllerTrait;


public function getRepositoryQuery() :RepositoryQueryInterface
{
return $this->get(ReductionCreditContainer::class)->getRepositoryQuery();
}

public function createEntity(string $entityFqcn)
{
return $this->getReductionCreditContainer()->getFactory()->create($this->getSectionCurrent());
}
}

+ 2
- 3
Controller/Section/OpeningAdminController.php Wyświetl plik

@@ -64,9 +64,8 @@ abstract class OpeningAdminController extends AbstractAdminController

public function createEntity(string $entityFqcn)
{
return $this->get(OpeningContainer::class)
return $this->getOpeningContainer()
->getFactory()
->create($this->get(SectionResolver::class)->getCurrent());
->create($this->getSectionCurrent());
}

}

+ 8
- 16
Controller/Section/SectionAdminController.php Wyświetl plik

@@ -7,30 +7,29 @@ use EasyCorp\Bundle\EasyAdminBundle\Field\FormField;
use EasyCorp\Bundle\EasyAdminBundle\Field\NumberField;
use EasyCorp\Bundle\EasyAdminBundle\Field\TextField;
use Lc\CaracoleBundle\Container\Section\SectionContainer;
use Lc\CaracoleBundle\Controller\AdminControllerTrait;
use Lc\CaracoleBundle\Factory\Section\SectionFactory;
use Lc\CaracoleBundle\Form\Section\OpeningsFormType;
use Lc\CaracoleBundle\Controller\AbstractAdminController;
use Lc\CaracoleBundle\Model\Section\SectionModel;
use Lc\CaracoleBundle\Resolver\MerchantResolver;
use Lc\SovBundle\Controller\AbstractAdminController;
use Lc\SovBundle\Field\BooleanField;
use Lc\SovBundle\Field\CKEditorField;
use Lc\SovBundle\Field\StatusField;
use Lc\SovBundle\Repository\RepositoryQueryInterface;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Session\SessionFactory;
use Symfony\Component\Routing\Annotation\Route;

abstract class SectionAdminController extends AbstractAdminController
{
use AdminControllerTrait;


public function getRepositoryQuery() :RepositoryQueryInterface
{
return $this->get(SectionContainer::class)->getRepositoryQuery();
}

public function createEntity(string $entityFqcn)
{
return $this->getSectionContainer()
->getFactory()
->create($this->getMerchantCurrent());
}

public function configureFields(string $pageName): iterable
{
return array_merge(
@@ -63,11 +62,4 @@ abstract class SectionAdminController extends AbstractAdminController
);
}

public function createEntity(string $entityFqcn)
{
return $this->get(SectionContainer::class)
->getFactory()
->create($this->get(MerchantResolver::class)->getCurrent());
}

}

+ 4
- 6
Controller/Site/NewsAdminController.php Wyświetl plik

@@ -2,20 +2,18 @@

namespace Lc\CaracoleBundle\Controller\Site;

use Lc\CaracoleBundle\Controller\AdminControllerTrait;
use Lc\CaracoleBundle\Resolver\SectionResolver;
use Lc\SovBundle\Container\Site\NewsContainer;
use Lc\CaracoleBundle\Controller\ControllerTrait;
use Lc\SovBundle\Controller\Site\NewsAdminController as SovNewsAdminController;

abstract class NewsAdminController extends SovNewsAdminController
{
use AdminControllerTrait;
use ControllerTrait;

public function createEntity(string $entityFqcn)
{
return $this->get(NewsContainer::class)
return $this->getNewsContainer()
->getFactory()
->setSection($this->get(SectionResolver::class)->getCurrent())
->setSection($this->getSectionCurrent())
->create();
}
}

+ 3
- 7
Controller/Site/PageAdminController.php Wyświetl plik

@@ -2,23 +2,19 @@

namespace Lc\CaracoleBundle\Controller\Site;

use Lc\CaracoleBundle\Controller\AdminControllerTrait;
use Lc\CaracoleBundle\Factory\Site\PageFactory;
use Lc\CaracoleBundle\Controller\ControllerTrait;
use Lc\CaracoleBundle\Resolver\SectionResolver;
use Lc\SovBundle\Container\Site\PageContainer;
use Lc\SovBundle\Controller\Site\PageAdminController as SovPageAdminController;
use Lc\SovBundle\Repository\RepositoryQueryInterface;

abstract class PageAdminController extends SovPageAdminController
{
use AdminControllerTrait;

use ControllerTrait;

public function createEntity(string $entityFqcn)
{
return $this->getPageContainer()
->getFactory()
->setSection($this->get(SectionResolver::class)->getCurrent())
->setSection($this->getSectionCurrent())
->create();
}
}

+ 4
- 10
Controller/Ticket/TicketAdminController.php Wyświetl plik

@@ -2,24 +2,18 @@

namespace Lc\CaracoleBundle\Controller\Ticket;

use App\Entity\Ticket\Ticket;
use Lc\CaracoleBundle\Controller\AdminControllerTrait;
use Lc\CaracoleBundle\Resolver\MerchantResolver;
use Lc\SovBundle\Container\Ticket\TicketContainer;
use Lc\CaracoleBundle\Controller\ControllerTrait;
use Lc\SovBundle\Controller\Ticket\TicketAdminController as SovTicketAdminController;
use Lc\CaracoleBundle\Factory\Ticket\TicketFactory;
use Lc\SovBundle\Repository\RepositoryQueryInterface;

abstract class TicketAdminController extends SovTicketAdminController
{
use AdminControllerTrait;
use ControllerTrait;

public function createEntity(string $entityFqcn)
{
return $this->get(TicketContainer::class)
return $this->getTicketContainer()
->getFactory()
->setMerchant($this->get(MerchantResolver::class)->getCurrent())
->setSection($this->getSectionCurrent())
->create();
}

}

+ 4
- 7
Controller/User/GroupUserAdminController.php Wyświetl plik

@@ -2,21 +2,18 @@

namespace Lc\CaracoleBundle\Controller\User;

use Lc\CaracoleBundle\Controller\AdminControllerTrait;
use Lc\CaracoleBundle\Factory\User\GroupUserFactory;
use Lc\CaracoleBundle\Resolver\MerchantResolver;
use Lc\SovBundle\Container\User\GroupUserContainer;
use Lc\CaracoleBundle\Controller\ControllerTrait;
use Lc\SovBundle\Controller\User\GroupUserAdminController as SovGroupUserAdminController;

abstract class GroupUserAdminController extends SovGroupUserAdminController
{
use AdminControllerTrait;
use ControllerTrait;

public function createEntity(string $entityFqcn)
{
return $this->get(GroupUserContainer::class)
return $this->getGroupUserContainer()
->getFactory()
->setMerchant($this->get(MerchantResolver::class)->getCurrent())
->setMerchant($this->getMerchantCurrent())
->create();
}
}

+ 57
- 59
Controller/User/UserMerchantAdminController.php Wyświetl plik

@@ -4,18 +4,14 @@ namespace Lc\CaracoleBundle\Controller\User;

use Doctrine\ORM\EntityManagerInterface;
use EasyCorp\Bundle\EasyAdminBundle\Collection\EntityCollection;
use EasyCorp\Bundle\EasyAdminBundle\Collection\FieldCollection;
use EasyCorp\Bundle\EasyAdminBundle\Config\Action;
use EasyCorp\Bundle\EasyAdminBundle\Config\Actions;
use EasyCorp\Bundle\EasyAdminBundle\Config\Crud;
use EasyCorp\Bundle\EasyAdminBundle\Config\Filters;
use EasyCorp\Bundle\EasyAdminBundle\Config\KeyValueStore;
use EasyCorp\Bundle\EasyAdminBundle\Context\AdminContext;
use EasyCorp\Bundle\EasyAdminBundle\Event\AfterCrudActionEvent;
use EasyCorp\Bundle\EasyAdminBundle\Event\BeforeCrudActionEvent;
use EasyCorp\Bundle\EasyAdminBundle\Exception\ForbiddenActionException;
use EasyCorp\Bundle\EasyAdminBundle\Exception\InsufficientEntityPermissionException;
use EasyCorp\Bundle\EasyAdminBundle\Factory\EntityFactory;
use EasyCorp\Bundle\EasyAdminBundle\Field\ArrayField;
use EasyCorp\Bundle\EasyAdminBundle\Field\AssociationField;
use EasyCorp\Bundle\EasyAdminBundle\Field\IntegerField;
@@ -25,10 +21,9 @@ use EasyCorp\Bundle\EasyAdminBundle\Provider\AdminContextProvider;
use EasyCorp\Bundle\EasyAdminBundle\Router\AdminUrlGenerator;
use EasyCorp\Bundle\EasyAdminBundle\Security\Permission;
use Lc\CaracoleBundle\Container\User\UserMerchantContainer;
use Lc\CaracoleBundle\Controller\AdminControllerTrait;
use Lc\CaracoleBundle\Controller\ControllerTrait;
use Lc\CaracoleBundle\Definition\ActionDefinition;
use Lc\CaracoleBundle\Factory\User\UserFactory;
use Lc\CaracoleBundle\Factory\User\UserMerchantFactory;
use Lc\CaracoleBundle\Form\Credit\CreditHistoryFormType;
use Lc\CaracoleBundle\Form\User\UserMerchantFormType;
use Lc\CaracoleBundle\Model\Credit\CreditHistoryInterface;
@@ -36,28 +31,31 @@ use Lc\CaracoleBundle\Resolver\MerchantResolver;
use Lc\SovBundle\Container\User\UserContainer;
use Lc\SovBundle\Controller\AbstractAdminController;
use Lc\SovBundle\Field\BooleanField;
use Lc\SovBundle\Field\ToggleField;
use Lc\SovBundle\Model\User\UserInterface;
use Lc\SovBundle\Repository\RepositoryQueryInterface;
use Lc\SovBundle\Translation\TranslatorAdmin;
use Symfony\Component\HttpFoundation\Response;

abstract class UserMerchantAdminController extends AbstractAdminController
{
use AdminControllerTrait;
use ControllerTrait;

public function getRepositoryQuery(): RepositoryQueryInterface
{
return $this->getUserMerchantContainer()->getRepositoryQuery();
}

public function getRepositoryQuery() :RepositoryQueryInterface
public function createEntity(string $entityFqcn)
{
return $this->get(UserMerchantContainer::class)->getRepositoryQuery();
return $this->getUserMerchantContainer()->getFactory()->createBase($this->getMerchantCurrent());
}

public function overrideEntitiesActions(?EntityCollection $entities): void
{
$context = $this->get(AdminContextProvider::class)->getContext();
$adminUrlGenerator = $this->get(AdminUrlGenerator::class);

$creditControllerFqcn = $context->getCrudControllers()->findCrudFqcnByEntityFqcn(
$this->get(EntityManagerInterface::class)->getEntityName(CreditHistoryInterface::class)
$this->get(EntityManagerInterface::class)->getEntityName(CreditHistoryInterface::class)
);

if ($entities) {
@@ -65,9 +63,9 @@ abstract class UserMerchantAdminController extends AbstractAdminController
foreach ($entity->getActions() as $action) {
if ($action->getName() == 'credit_history') {
$url = $adminUrlGenerator
->setController($creditControllerFqcn)
->set('userMerchantId', $entity->getInstance()->getId())
->generateUrl();
->setController($creditControllerFqcn)
->set('userMerchantId', $entity->getInstance()->getId())
->generateUrl();
$action->setLinkUrl($url);
}
}
@@ -80,14 +78,14 @@ abstract class UserMerchantAdminController extends AbstractAdminController
$actions = parent::configureActions($actions);

$creditAction = Action::new('credit_history', false, 'fa fa-cash-register')
->linkToCrudAction('credit_history')
->setHtmlAttributes(
array(
'data-toggle' => 'tooltip',
'title' => $this->get(TranslatorAdmin::class)->transAction('credit'),
->linkToCrudAction('credit_history')
->setHtmlAttributes(
array(
'data-toggle' => 'tooltip',
'title' => $this->get(TranslatorAdmin::class)->transAction('credit'),
)
)
)
->setCssClass('btn btn-sm btn-success');
->setCssClass('btn btn-sm btn-success');
$actions->add(Crud::PAGE_INDEX, $creditAction);

return $actions;
@@ -96,13 +94,13 @@ abstract class UserMerchantAdminController extends AbstractAdminController
public function configureFields(string $pageName): iterable
{
$fields = [
IntegerField::new('id')->onlyOnIndex()->setSortable(true),
TextField::new('user.lastname')->setSortable(true),
TextField::new('user.firstname')->setSortable(true),
TextField::new('user.email')->setSortable(true),
BooleanField::new('active')->setSortable(true),
BooleanField::new('creditActive')->hideOnIndex(),
AssociationField::new('user'),
IntegerField::new('id')->onlyOnIndex()->setSortable(true),
TextField::new('user.lastname')->setSortable(true),
TextField::new('user.firstname')->setSortable(true),
TextField::new('user.email')->setSortable(true),
BooleanField::new('active')->setSortable(true),
BooleanField::new('creditActive')->hideOnIndex(),
AssociationField::new('user'),
];

if ($this->isGranted('ROLE_SUPER_ADMIN')) {
@@ -115,7 +113,7 @@ abstract class UserMerchantAdminController extends AbstractAdminController
public function configureFilters(Filters $filters): Filters
{
return $filters
->add(BooleanFilter::new('active'));
->add(BooleanFilter::new('active'));
}

public function new(AdminContext $context): Response
@@ -124,8 +122,8 @@ abstract class UserMerchantAdminController extends AbstractAdminController
$merchantResolver = $this->get(MerchantResolver::class);

$userMerchant = $this->get(UserMerchantContainer::class)
->getFactory()
->create($merchantResolver->getCurrent());
->getFactory()
->create($merchantResolver->getCurrent());

$form = $this->createForm(UserMerchantFormType::class, $userMerchant);

@@ -150,7 +148,7 @@ abstract class UserMerchantAdminController extends AbstractAdminController
$userMerchant->setUser($user);
$entityManager->create($userMerchant);
$entityManager->flush();
$this->addFlashTranslator('success','created');
$this->addFlashTranslator('success', 'created');
$url = $this->get(AdminUrlGenerator::class)->setAction(ActionDefinition::INDEX)->generateUrl();

return $this->redirect($url);
@@ -167,16 +165,16 @@ abstract class UserMerchantAdminController extends AbstractAdminController

return $this->redirect($url);
} else {
$this->addFlashTranslator('error','already_exist');
$this->addFlashTranslator('error', 'already_exist');
}
}
}

return $this->render(
'@LcCaracole/admin/user/new_usermerchant.html.twig',
[
'form' => $form->createView(),
]
'@LcCaracole/admin/user/new_usermerchant.html.twig',
[
'form' => $form->createView(),
]
);
}

@@ -212,10 +210,10 @@ abstract class UserMerchantAdminController extends AbstractAdminController
}

return $this->render(
'@LcCaracole/admin/user/edit_usermerchant.html.twig',
[
'form' => $form->createView(),
]
'@LcCaracole/admin/user/edit_usermerchant.html.twig',
[
'form' => $form->createView(),
]
);
}

@@ -228,8 +226,8 @@ abstract class UserMerchantAdminController extends AbstractAdminController
}

if (!$this->isGranted(
Permission::EA_EXECUTE_ACTION,
['action' => ActionDefinition::DETAIL, 'entity' => $context->getEntity()]
Permission::EA_EXECUTE_ACTION,
['action' => ActionDefinition::DETAIL, 'entity' => $context->getEntity()]
)) {
throw new ForbiddenActionException($context);
}
@@ -238,25 +236,25 @@ abstract class UserMerchantAdminController extends AbstractAdminController
}

$options['action'] = $adminUrlGenerator
->setController($context->getCrud()->getControllerFqcn())
->setAction('add_credit')
->setEntityId($context->getEntity()->getInstance()->getId())
->set('userMerchant', 'niche')
->generateUrl();
->setController($context->getCrud()->getControllerFqcn())
->setAction('add_credit')
->setEntityId($context->getEntity()->getInstance()->getId())
->set('userMerchant', 'niche')
->generateUrl();
$addCreditHistoryForm = $this->createForm(CreditHistoryFormType::class, null, $options)->createView();


return $this->render(
'@LcCaracole/admin/credit/credit_detail.html.twig',
[
'pageName' => Crud::PAGE_DETAIL,
'entity' => $context->getEntity(),
'batch_actions' => array(),
'entities' => array(),
'filters' => array(),
'paginator' => array(),
'add_credit_history_form' => $addCreditHistoryForm,
]
'@LcCaracole/admin/credit/credit_detail.html.twig',
[
'pageName' => Crud::PAGE_DETAIL,
'entity' => $context->getEntity(),
'batch_actions' => array(),
'entities' => array(),
'filters' => array(),
'paginator' => array(),
'add_credit_history_form' => $addCreditHistoryForm,
]
);
}


+ 7
- 4
Factory/Product/ProductFamilyFactory.php Wyświetl plik

@@ -11,14 +11,17 @@ use Lc\SovBundle\Factory\AbstractFactory;

class ProductFamilyFactory extends AbstractFactory
{

public function create(SectionInterface $section): ProductFamilyInterface
public function create(MerchantInterface $merchant): ProductFamilyInterface
{
$productFamily = new ProductFamily();

$productFamily->setSection($section);
$productFamilySectionPropertyFactory = new ProductFamilySectionPropertyFactory();

foreach($merchant->getSections() as $section) {
$productFamilySectionProperty = $productFamilySectionPropertyFactory->create($section, $productFamily);
$productFamily->addProductFamilySectionProperty($productFamilySectionProperty);
}

return $productFamily;
}

}

+ 2
- 2
Factory/Ticket/TicketFactory.php Wyświetl plik

@@ -10,13 +10,13 @@ use Lc\SovBundle\Model\Ticket\TicketInterface;

class TicketFactory extends SovTicketFactory
{
use MerchantContextTrait;
use SectionContextTrait;

public function create(): TicketInterface
{
$ticket = parent::create();

$ticket->setMerchant($this->merchant);
$ticket->setSection($this->section);

return $ticket;
}

+ 9
- 3
Factory/User/UserMerchantFactory.php Wyświetl plik

@@ -11,12 +11,18 @@ use Lc\SovBundle\Model\User\UserInterface;

class UserMerchantFactory extends AbstractFactory
{
// createUserMerchant
public function create(MerchantInterface $merchant, UserInterface $user = null): UserMerchantInterface
public function createBase(MerchantInterface $merchant): UserMerchantInterface
{
$userMerchant = new UserMerchant();

$userMerchant->setMerchant($merchant);

return $userMerchant;
}

// createUserMerchant
public function create(MerchantInterface $merchant, UserInterface $user = null): UserMerchantInterface
{
$userMerchant = $this->createBase($merchant);
$userMerchant->setUser($user);

return $userMerchant;

+ 2
- 8
Repository/Reduction/ReductionCatalogStore.php Wyświetl plik

@@ -26,9 +26,7 @@ class ReductionCatalogStore extends AbstractStore

public function filtersDefault(RepositoryQueryInterface $query): RepositoryQueryInterface
{
if($this->section) {
$query->filterBySection($this->section);
}
$this->addFilterBySectionOptionnal($query);
$query->filterIsOnlineAndOffline();
return $query;
}
@@ -38,14 +36,10 @@ class ReductionCatalogStore extends AbstractStore
return $query;
}


public function getByProductFamily(ProductFamilyInterface $productFamily, $query = null)
{
$query = $this->createDefaultQuery($query);

$query
->filterProductFamily($productFamily);

$query->filterProductFamily($productFamily);
return $query->findOne();
}
}

Ładowanie…
Anuluj
Zapisz