소스 검색

Intégration app reduction

develop
Fab 3 년 전
부모
커밋
659e69a9fb
59개의 변경된 파일1160개의 추가작업 그리고 453개의 파일을 삭제
  1. +1
    -1
      Builder/Ticket/TicketBuilder.php
  2. +1
    -1
      Builder/User/UserBuilder.php
  3. +14
    -0
      Component/DateComponent.php
  4. +1
    -1
      Component/FormComponent.php
  5. +39
    -0
      Container/File/FileContainer.php
  6. +39
    -0
      Container/Newsletter/NewsletterContainer.php
  7. +39
    -0
      Container/Reminder/ReminderContainer.php
  8. +48
    -0
      Container/Setting/SiteSettingContainer.php
  9. +39
    -0
      Container/Site/NewsContainer.php
  10. +39
    -0
      Container/Site/PageContainer.php
  11. +39
    -0
      Container/Site/SiteContainer.php
  12. +48
    -0
      Container/Ticket/TicketContainer.php
  13. +39
    -0
      Container/Ticket/TicketMessageContainer.php
  14. +39
    -0
      Container/User/GroupUserContainer.php
  15. +48
    -0
      Container/User/UserContainer.php
  16. +30
    -6
      Controller/AbstractAdminController.php
  17. +2
    -2
      Controller/Newsletter/NewsletterAdminController.php
  18. +7
    -8
      Controller/Reminder/ReminderAdminController.php
  19. +9
    -25
      Controller/Setting/SettingAdminController.php
  20. +2
    -2
      Controller/Site/NewsAdminController.php
  21. +2
    -2
      Controller/Site/PageAdminController.php
  22. +10
    -9
      Controller/Ticket/TicketAdminController.php
  23. +8
    -7
      Controller/User/AccountAdminController.php
  24. +2
    -2
      Controller/User/GroupUserAdminController.php
  25. +3
    -3
      Controller/User/UserAdminController.php
  26. +51
    -0
      Doctrine/Extension/BlameableNullableTrait.php
  27. +1
    -1
      Factory/File/FileFactory.php
  28. +0
    -8
      Factory/File/FileFactoryInterface.php
  29. +1
    -1
      Factory/Newsletter/NewsletterFactory.php
  30. +0
    -8
      Factory/Newsletter/NewsletterFactoryInterface.php
  31. +5
    -2
      Factory/Reminder/ReminderFactory.php
  32. +6
    -4
      Model/Setting/EntitySettingTrait.php
  33. +8
    -0
      Model/Setting/SettingInterface.php
  34. +1
    -12
      Model/Setting/SettingModel.php
  35. +54
    -0
      Model/Site/NewsModel.php
  36. +0
    -17
      Model/Site/PageModel.php
  37. +2
    -14
      Model/Ticket/TicketMessageModel.php
  38. +4
    -83
      Model/Ticket/TicketModel.php
  39. +118
    -26
      Model/User/UserModel.php
  40. +29
    -26
      Repository/AbstractRepository.php
  41. +32
    -4
      Repository/AbstractRepositoryQuery.php
  42. +20
    -0
      Repository/AbstractStore.php
  43. +22
    -85
      Repository/Reminder/ReminderStore.php
  44. +0
    -2
      Repository/Site/NewsRepositoryQuery.php
  45. +4
    -20
      Repository/Site/NewsStore.php
  46. +0
    -6
      Repository/Site/PageRepositoryQuery.php
  47. +0
    -11
      Repository/Site/PageStore.php
  48. +26
    -0
      Repository/StatusRepositoryQueryTrait.php
  49. +2
    -2
      Repository/Ticket/TicketRepositoryQuery.php
  50. +10
    -16
      Repository/Ticket/TicketStore.php
  51. +24
    -0
      Repository/TreeRepositoryQueryTrait.php
  52. +1
    -1
      Repository/User/UserRepository.php
  53. +16
    -8
      Repository/User/UserRepositoryQuery.php
  54. +18
    -20
      Repository/User/UserStore.php
  55. +2
    -2
      Resolver/UrlResolver.php
  56. +21
    -0
      Solver/Setting/SettingSolver.php
  57. +76
    -0
      Solver/Ticket/TicketSolver.php
  58. +53
    -0
      Solver/User/UserSolver.php
  59. +5
    -5
      Translation/TranslatorAdmin.php

+ 1
- 1
Builder/Ticket/TicketBuilder.php 파일 보기

@@ -17,7 +17,7 @@ class TicketBuilder
}

// uploadImageTicketMessage
public function uploadImageTicketMessage($formTicket)
public function uploadImageTicketMessage($formTicket): ?string
{
return $this->formComponent->uploadFile(
$formTicket,

+ 1
- 1
Builder/User/UserBuilder.php 파일 보기

@@ -15,7 +15,7 @@ class UserBuilder
$this->entityManager = $entityManager;
}

public function setNewsletter(UserInterface $user, NewsletterInterface $newsletter, bool $subscribeNewsletter)
public function setNewsletter(UserInterface $user, NewsletterInterface $newsletter, bool $subscribeNewsletter): void
{
if ($subscribeNewsletter) {
$user->addNewsletter($newsletter);

+ 14
- 0
Component/DateComponent.php 파일 보기

@@ -52,4 +52,18 @@ class DateComponent
return '';
}

// getDeliverySlotHour
public function getHour(\DateTime $date)
{
$timestamp = $date->getTimestamp() ;
$hour = $this->date('%kh', $timestamp) ;
$minutes = $this->date('%M', $timestamp) ;

if($minutes != '00') {
$hour .= $minutes ;
}

return $hour ;
}

}

+ 1
- 1
Component/FormComponent.php 파일 보기

@@ -32,7 +32,7 @@ class FormComponent
}

// uploadImageTicketMessage
public function uploadFile($form, $child, $directory, $subdirectory)
public function uploadFile($form, $child, $directory, $subdirectory): ?string
{
$file = $form->get($child)->getData();


+ 39
- 0
Container/File/FileContainer.php 파일 보기

@@ -0,0 +1,39 @@
<?php

namespace Lc\SovBundle\Container\File;

use Lc\SovBundle\Factory\File\FileFactory;
use Lc\SovBundle\Repository\File\FileRepositoryQuery;
use Lc\SovBundle\Repository\File\FileStore;

class FileContainer
{
protected FileFactory $factory;
protected FileRepositoryQuery $repositoryQuery;
protected FileStore $store;

public function __construct(
FileFactory $factory,
FileRepositoryQuery $repositoryQuery,
FileStore $store
) {
$this->factory = $factory;
$this->repositoryQuery = $repositoryQuery;
$this->store = $store;
}

public function getFactory(): FileFactory
{
return $this->factory;
}

public function getRepositoryQuery(): FileRepositoryQuery
{
return $this->repositoryQuery;
}

public function getStore(): FileStore
{
return $this->store;
}
}

+ 39
- 0
Container/Newsletter/NewsletterContainer.php 파일 보기

@@ -0,0 +1,39 @@
<?php

namespace Lc\SovBundle\Container\Newsletter;

use Lc\SovBundle\Factory\Newsletter\NewsletterFactory;
use Lc\SovBundle\Repository\Newsletter\NewsletterRepositoryQuery;
use Lc\SovBundle\Repository\Newsletter\NewsletterStore;

class NewsletterContainer
{
protected NewsletterFactory $factory;
protected NewsletterRepositoryQuery $repositoryQuery;
protected NewsletterStore $store;

public function __construct(
NewsletterFactory $factory,
NewsletterRepositoryQuery $repositoryQuery,
NewsletterStore $store
) {
$this->factory = $factory;
$this->repositoryQuery = $repositoryQuery;
$this->store = $store;
}

public function getFactory(): NewsletterFactory
{
return $this->factory;
}

public function getRepositoryQuery(): NewsletterRepositoryQuery
{
return $this->repositoryQuery;
}

public function getStore(): NewsletterStore
{
return $this->store;
}
}

+ 39
- 0
Container/Reminder/ReminderContainer.php 파일 보기

@@ -0,0 +1,39 @@
<?php

namespace Lc\SovBundle\Container\Reminder;

use Lc\SovBundle\Factory\Reminder\ReminderFactory;
use Lc\SovBundle\Repository\Reminder\ReminderRepositoryQuery;
use Lc\SovBundle\Repository\Reminder\ReminderStore;

class ReminderContainer
{
protected ReminderFactory $factory;
protected ReminderRepositoryQuery $repositoryQuery;
protected ReminderStore $store;

public function __construct(
ReminderFactory $factory,
ReminderRepositoryQuery $repositoryQuery,
ReminderStore $store
) {
$this->factory = $factory;
$this->repositoryQuery = $repositoryQuery;
$this->store = $store;
}

public function getFactory(): ReminderFactory
{
return $this->factory;
}

public function getRepositoryQuery(): ReminderRepositoryQuery
{
return $this->repositoryQuery;
}

public function getStore(): ReminderStore
{
return $this->store;
}
}

+ 48
- 0
Container/Setting/SiteSettingContainer.php 파일 보기

@@ -0,0 +1,48 @@
<?php

namespace Lc\SovBundle\Container\Setting;

use Lc\SovBundle\Definition\SiteSettingDefinition;
use Lc\SovBundle\Factory\Setting\SiteSettingFactory;
use Lc\SovBundle\Repository\Setting\SiteSettingRepositoryQuery;
use Lc\SovBundle\Repository\Setting\SiteSettingStore;

class SiteSettingContainer
{
protected SiteSettingFactory $factory;
protected SiteSettingDefinition $definition;
protected SiteSettingRepositoryQuery $repositoryQuery;
protected SiteSettingStore $store;

public function __construct(
SiteSettingFactory $factory,
SiteSettingDefinition $definition,
SiteSettingRepositoryQuery $repositoryQuery,
SiteSettingStore $store
) {
$this->factory = $factory;
$this->definition = $definition;
$this->repositoryQuery = $repositoryQuery;
$this->store = $store;
}

public function getFactory(): SiteSettingFactory
{
return $this->factory;
}

public function getDefinition(): SiteSettingDefinition
{
return $this->definition;
}

public function getRepositoryQuery(): SiteSettingRepositoryQuery
{
return $this->repositoryQuery;
}

public function getStore(): SiteSettingStore
{
return $this->store;
}
}

+ 39
- 0
Container/Site/NewsContainer.php 파일 보기

@@ -0,0 +1,39 @@
<?php

namespace Lc\SovBundle\Container\Site;

use Lc\SovBundle\Factory\Site\NewsFactory;
use Lc\SovBundle\Repository\Site\NewsRepositoryQuery;
use Lc\SovBundle\Repository\Site\NewsStore;

class NewsContainer
{
protected NewsFactory $factory;
protected NewsRepositoryQuery $repositoryQuery;
protected NewsStore $store;

public function __construct(
NewsFactory $factory,
NewsRepositoryQuery $repositoryQuery,
NewsStore $store
) {
$this->factory = $factory;
$this->repositoryQuery = $repositoryQuery;
$this->store = $store;
}

public function getFactory(): NewsFactory
{
return $this->factory;
}

public function getRepositoryQuery(): NewsRepositoryQuery
{
return $this->repositoryQuery;
}

public function getStore(): NewsStore
{
return $this->store;
}
}

+ 39
- 0
Container/Site/PageContainer.php 파일 보기

@@ -0,0 +1,39 @@
<?php

namespace Lc\SovBundle\Container\Site;

use Lc\SovBundle\Factory\Site\PageFactory;
use Lc\SovBundle\Repository\Site\PageRepositoryQuery;
use Lc\SovBundle\Repository\Site\PageStore;

class PageContainer
{
protected PageFactory $factory;
protected PageRepositoryQuery $repositoryQuery;
protected PageStore $store;

public function __construct(
PageFactory $factory,
PageRepositoryQuery $repositoryQuery,
PageStore $store
) {
$this->factory = $factory;
$this->repositoryQuery = $repositoryQuery;
$this->store = $store;
}

public function getFactory(): PageFactory
{
return $this->factory;
}

public function getRepositoryQuery(): PageRepositoryQuery
{
return $this->repositoryQuery;
}

public function getStore(): PageStore
{
return $this->store;
}
}

+ 39
- 0
Container/Site/SiteContainer.php 파일 보기

@@ -0,0 +1,39 @@
<?php

namespace Lc\SovBundle\Container\Site;

use Lc\SovBundle\Factory\Site\SiteFactory;
use Lc\SovBundle\Repository\Site\SiteRepositoryQuery;
use Lc\SovBundle\Repository\Site\SiteStore;

class SiteContainer
{
protected SiteFactory $factory;
protected SiteRepositoryQuery $repositoryQuery;
protected SiteStore $store;

public function __construct(
SiteFactory $factory,
SiteRepositoryQuery $repositoryQuery,
SiteStore $store
) {
$this->factory = $factory;
$this->repositoryQuery = $repositoryQuery;
$this->store = $store;
}

public function getFactory(): SiteFactory
{
return $this->factory;
}

public function getRepositoryQuery(): SiteRepositoryQuery
{
return $this->repositoryQuery;
}

public function getStore(): SiteStore
{
return $this->store;
}
}

+ 48
- 0
Container/Ticket/TicketContainer.php 파일 보기

@@ -0,0 +1,48 @@
<?php

namespace Lc\SovBundle\Container\Ticket;

use Lc\SovBundle\Builder\Ticket\TicketBuilder;
use Lc\SovBundle\Factory\Ticket\TicketFactory;
use Lc\SovBundle\Repository\Ticket\TicketRepositoryQuery;
use Lc\SovBundle\Repository\Ticket\TicketStore;

class TicketContainer
{
protected TicketFactory $factory;
protected TicketBuilder $builder;
protected TicketRepositoryQuery $repositoryQuery;
protected TicketStore $store;

public function __construct(
TicketFactory $factory,
TicketBuilder $builder,
TicketRepositoryQuery $repositoryQuery,
TicketStore $store
) {
$this->factory = $factory;
$this->builder = $builder;
$this->repositoryQuery = $repositoryQuery;
$this->store = $store;
}

public function getFactory(): TicketFactory
{
return $this->factory;
}

public function getBuilder(): TicketBuilder
{
return $this->builder;
}

public function getRepositoryQuery(): TicketRepositoryQuery
{
return $this->repositoryQuery;
}

public function getStore(): TicketStore
{
return $this->store;
}
}

+ 39
- 0
Container/Ticket/TicketMessageContainer.php 파일 보기

@@ -0,0 +1,39 @@
<?php

namespace Lc\SovBundle\Container\Ticket;

use Lc\SovBundle\Factory\Ticket\TicketMessageFactory;
use Lc\SovBundle\Repository\Ticket\TicketMessageRepositoryQuery;
use Lc\SovBundle\Repository\Ticket\TicketMessageStore;

class TicketMessageContainer
{
protected TicketMessageFactory $factory;
protected TicketMessageRepositoryQuery $repositoryQuery;
protected TicketMessageStore $store;

public function __construct(
TicketMessageFactory $factory,
TicketMessageRepositoryQuery $repositoryQuery,
TicketMessageStore $store
) {
$this->factory = $factory;
$this->repositoryQuery = $repositoryQuery;
$this->store = $store;
}

public function getFactory(): TicketMessageFactory
{
return $this->factory;
}

public function getRepositoryQuery(): TicketMessageRepositoryQuery
{
return $this->repositoryQuery;
}

public function getStore(): TicketMessageStore
{
return $this->store;
}
}

+ 39
- 0
Container/User/GroupUserContainer.php 파일 보기

@@ -0,0 +1,39 @@
<?php

namespace Lc\SovBundle\Container\User;

use Lc\SovBundle\Factory\User\GroupUserFactory;
use Lc\SovBundle\Repository\User\GroupUserRepositoryQuery;
use Lc\SovBundle\Repository\User\GroupUserStore;

class GroupUserContainer
{
protected GroupUserFactory $factory;
protected GroupUserRepositoryQuery $repositoryQuery;
protected GroupUserStore $store;

public function __construct(
GroupUserFactory $factory,
GroupUserRepositoryQuery $repositoryQuery,
GroupUserStore $store
) {
$this->factory = $factory;
$this->repositoryQuery = $repositoryQuery;
$this->store = $store;
}

public function getFactory(): GroupUserFactory
{
return $this->factory;
}

public function getRepositoryQuery(): GroupUserRepositoryQuery
{
return $this->repositoryQuery;
}

public function getStore(): GroupUserStore
{
return $this->store;
}
}

+ 48
- 0
Container/User/UserContainer.php 파일 보기

@@ -0,0 +1,48 @@
<?php

namespace Lc\SovBundle\Container\User;

use Lc\SovBundle\Builder\User\UserBuilder;
use Lc\SovBundle\Factory\User\UserFactory;
use Lc\SovBundle\Repository\User\UserRepositoryQuery;
use Lc\SovBundle\Repository\User\UserStore;

class UserContainer
{
protected UserFactory $factory;
protected UserBuilder $builder;
protected UserRepositoryQuery $repositoryQuery;
protected UserStore $store;

public function __construct(
UserFactory $factory,
UserBuilder $builder,
UserRepositoryQuery $repositoryQuery,
UserStore $store
) {
$this->factory = $factory;
$this->builder = $builder;
$this->repositoryQuery = $repositoryQuery;
$this->store = $store;
}

public function getFactory(): UserFactory
{
return $this->factory;
}

public function getBuilder(): UserBuilder
{
return $this->builder;
}

public function getRepositoryQuery(): UserRepositoryQuery
{
return $this->repositoryQuery;
}

public function getStore(): UserStore
{
return $this->store;
}
}

+ 30
- 6
Controller/AbstractAdminController.php 파일 보기

@@ -37,6 +37,17 @@ use EasyCorp\Bundle\EasyAdminBundle\Provider\AdminContextProvider;
use EasyCorp\Bundle\EasyAdminBundle\Router\AdminUrlGenerator;
use EasyCorp\Bundle\EasyAdminBundle\Security\Permission;
use Lc\SovBundle\Component\EntityComponent;
use Lc\SovBundle\Container\File\FileContainer;
use Lc\SovBundle\Container\Newsletter\NewsletterContainer;
use Lc\SovBundle\Container\Reminder\ReminderContainer;
use Lc\SovBundle\Container\Setting\SiteSettingContainer;
use Lc\SovBundle\Container\Site\NewsContainer;
use Lc\SovBundle\Container\Site\PageContainer;
use Lc\SovBundle\Container\Site\SiteContainer;
use Lc\SovBundle\Container\Ticket\TicketContainer;
use Lc\SovBundle\Container\Ticket\TicketMessageContainer;
use Lc\SovBundle\Container\User\GroupUserContainer;
use Lc\SovBundle\Container\User\UserContainer;
use Lc\SovBundle\Doctrine\Extension\DevAliasInterface;
use Lc\SovBundle\Doctrine\Extension\SeoInterface;
use Lc\SovBundle\Doctrine\Extension\SortableInterface;
@@ -53,6 +64,7 @@ use Symfony\Component\Form\Extension\Core\Type\DateTimeType;
use Symfony\Component\Form\Extension\Core\Type\DateType;
use Symfony\Component\Form\Extension\Core\Type\IntegerType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormInterface;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\RequestStack;
use Symfony\Component\HttpFoundation\Session\SessionInterface;
@@ -60,19 +72,31 @@ use Symfony\Component\HttpFoundation\Session\SessionInterface;

abstract class AbstractAdminController extends EaAbstractCrudController
{
protected $filtersForm;
protected FormInterface $filtersForm;

public static function getSubscribedServices()
{
return array_merge(
parent::getSubscribedServices(),
[
'session' => SessionInterface::class,
'request' => RequestStack::class,
'em' => EntityManagerInterface::class,
'translator_admin' => TranslatorAdmin::class,
TranslatorAdmin::class => TranslatorAdmin::class,
'filter_manager' => FilterManager::class,
SessionInterface::class => SessionInterface::class,
RequestStack::class => RequestStack::class,
EntityManagerInterface::class => EntityManagerInterface::class,
FilterManager::class => FilterManager::class,

FileContainer::class => FileContainer::class,
NewsletterContainer::class => NewsletterContainer::class,
ReminderContainer::class => ReminderContainer::class,
NewsContainer::class => NewsContainer::class,
PageContainer::class => PageContainer::class,
SiteContainer::class => SiteContainer::class,
TicketContainer::class => TicketContainer::class,
TicketMessageContainer::class => TicketMessageContainer::class,
GroupUserContainer::class => GroupUserContainer::class,
UserContainer::class => UserContainer::class,
SiteSettingContainer::class => SiteSettingContainer::class,

]
);
}

+ 2
- 2
Controller/Newsletter/NewsletterAdminController.php 파일 보기

@@ -4,6 +4,7 @@ namespace Lc\SovBundle\Controller\Newsletter;

use EasyCorp\Bundle\EasyAdminBundle\Field\FormField;
use EasyCorp\Bundle\EasyAdminBundle\Field\TextField;
use Lc\SovBundle\Container\Newsletter\NewsletterContainer;
use Lc\SovBundle\Controller\AbstractAdminController;
use Lc\SovBundle\Factory\Newsletter\NewsletterFactory;
use Lc\SovBundle\Field\BooleanField;
@@ -31,8 +32,7 @@ abstract class NewsletterAdminController extends AbstractAdminController

public function createEntity(string $entityFqcn)
{
$factory = new NewsletterFactory();
return $factory->create();
return $this->get(NewsletterContainer::class)->getFactory()->create();
}

}

+ 7
- 8
Controller/Reminder/ReminderAdminController.php 파일 보기

@@ -5,10 +5,9 @@ namespace Lc\SovBundle\Controller\Reminder;
use Doctrine\ORM\EntityManagerInterface;
use Lc\CaracoleBundle\Resolver\MerchantResolver;
use Lc\CaracoleBundle\Resolver\SectionResolver;
use Lc\SovBundle\Container\Reminder\ReminderContainer;
use Lc\SovBundle\Factory\Reminder\ReminderFactory;
use Lc\SovBundle\Factory\Reminder\ReminderFactoryInterface;
use Lc\SovBundle\Form\Reminder\ReminderAdminFormType;
use Lc\SovBundle\Repository\Reminder\ReminderRepositoryQueryInterface;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
use Symfony\Component\Form\FormFactoryInterface;
@@ -22,7 +21,7 @@ class ReminderAdminController extends AbstractController
{

protected EntityManagerInterface $entityManager;
protected ReminderRepositoryQueryInterface $reminderRepositoryQuery;
protected ReminderContainer $reminderContainer;
protected FormFactoryInterface $formFactory;
protected UrlGeneratorInterface $urlGenerator;
protected MerchantResolver $merchantResolver;
@@ -31,13 +30,13 @@ class ReminderAdminController extends AbstractController

public function __construct(
EntityManagerInterface $entityManager,
ReminderRepositoryQueryInterface $reminderRepositoryQuery,
ReminderContainer $reminderContainer,
FormFactoryInterface $formFactory,
UrlGeneratorInterface $urlGenerator,
ParameterBagInterface $parameterBag
) {
$this->entityManager = $entityManager;
$this->reminderRepositoryQuery = $reminderRepositoryQuery;
$this->reminderContainer = $reminderContainer;
$this->formFactory = $formFactory;
$this->urlGenerator = $urlGenerator;
$this->parameterBag = $parameterBag;
@@ -51,7 +50,7 @@ class ReminderAdminController extends AbstractController
$id = $request->get('id');

if($id) {
$reminder = $this->reminderRepositoryQuery->getRepository()->find($id);
$reminder = $this->reminderContainer->getRepositoryQuery()->getRepository()->find($id);
$action = $this->urlGenerator->generate(
$this->parameterBag->get('app.reminder.route_edit'),
['id' => $id]
@@ -110,7 +109,7 @@ class ReminderAdminController extends AbstractController
public function edit(Request $request)
{
$id = $request->get('id');
$reminder = $this->reminderRepositoryQuery->getRepository()->find($id);
$reminder = $this->reminderContainer->getRepositoryQuery()->getRepository()->find($id);

$form = $this->formFactory->create(ReminderAdminFormType::class, $reminder);
$form->handleRequest($request);
@@ -132,7 +131,7 @@ class ReminderAdminController extends AbstractController
public function done(Request $request): JsonResponse
{
$id = $request->get('id');
$reminder = $this->reminderRepositoryQuery->getRepository()->find($id);
$reminder = $this->reminderContainer->getRepositoryQuery()->getRepository()->find($id);
$done = $request->get('done');

if($done == 'true') {

+ 9
- 25
Controller/Setting/SettingAdminController.php 파일 보기

@@ -3,6 +3,8 @@
namespace Lc\SovBundle\Controller\Setting;

use Doctrine\ORM\EntityManagerInterface;
use Lc\SovBundle\Container\Setting\SiteSettingContainer;
use Lc\SovBundle\Container\Site\SiteContainer;
use Lc\SovBundle\Definition\SiteSettingDefinitionInterface;
use Lc\SovBundle\Form\Setting\SiteSettingsFormType;
use Lc\SovBundle\Repository\Setting\SiteSettingRepository;
@@ -14,48 +16,30 @@ use Symfony\Component\Routing\Annotation\Route;

class SettingAdminController extends AbstractController
{
protected $em;
protected $translatorAdmin;
protected $siteSettingRepository;
protected $siteSettingDefinition;
protected $siteRepository;

public function __construct(
EntityManagerInterface $em,
TranslatorAdmin $translatorAdmin,
SiteSettingRepository $siteSettingRepository,
SiteSettingDefinitionInterface $siteSettingDefinition,
SiteRepository $siteRepository
) {
$this->em = $em;
$this->translatorAdmin = $translatorAdmin;
$this->siteSettingRepository = $siteSettingRepository;
$this->siteSettingDefinition = $siteSettingDefinition;
$this->siteRepository = $siteRepository;
}

/**
* @Route("/admin/setting/site", name="sov_admin_setting_site")
*/
public function manageGlobal(Request $request)
public function manageGlobal(Request $request, EntityManagerInterface $entityManager)
{
$site = $this->siteRepository->findOneByDevAlias('default') ;

$site = $this->get(SiteContainer::class)->getStore()->getOneByDevAlias('default') ;
$form = $this->createForm(SiteSettingsFormType::class, $site);

$form->handleRequest($request);

if ($form->isSubmitted() && $form->isValid()) {

$this->em->update($site);
$this->em->flush();
$entityManager->update($site);
$entityManager->flush();

$this->addFlash('success', $this->translatorAdmin->transFlashMessage('settings_saved'));
$this->addFlash('success', $this->get(TranslatorAdmin::class)->transFlashMessage('settings_saved'));
}

return $this->render(
'@LcSov/admin/setting/edit_site.html.twig' ,
[
'setting_definition' => $this->siteSettingDefinition,
'setting_definition' => $this->get(SiteSettingContainer::class)->getDefinition(),
'form' => $form->createView()
]
);

+ 2
- 2
Controller/Site/NewsAdminController.php 파일 보기

@@ -6,6 +6,7 @@ use EasyCorp\Bundle\EasyAdminBundle\Field\DateField;
use EasyCorp\Bundle\EasyAdminBundle\Field\FormField;
use EasyCorp\Bundle\EasyAdminBundle\Field\NumberField;
use EasyCorp\Bundle\EasyAdminBundle\Field\TextField;
use Lc\SovBundle\Container\Site\NewsContainer;
use Lc\SovBundle\Controller\AbstractAdminController;
use Lc\SovBundle\Factory\Site\NewsFactory;
use Lc\SovBundle\Field\CKEditorField;
@@ -36,7 +37,6 @@ abstract class NewsAdminController extends AbstractAdminController

public function createEntity(string $entityFqcn)
{
$factory = new NewsFactory();
return $factory->create();
return $this->get(NewsContainer::class)->getFactory()->create();
}
}

+ 2
- 2
Controller/Site/PageAdminController.php 파일 보기

@@ -5,6 +5,7 @@ namespace Lc\SovBundle\Controller\Site;
use EasyCorp\Bundle\EasyAdminBundle\Field\FormField;
use EasyCorp\Bundle\EasyAdminBundle\Field\NumberField;
use EasyCorp\Bundle\EasyAdminBundle\Field\TextField;
use Lc\SovBundle\Container\Site\PageContainer;
use Lc\SovBundle\Controller\AbstractAdminController;
use Lc\SovBundle\Factory\Site\PageFactory;
use Lc\SovBundle\Field\CKEditorField;
@@ -33,8 +34,7 @@ abstract class PageAdminController extends AbstractAdminController

public function createEntity(string $entityFqcn)
{
$factory = new PageFactory();
return $factory->create();
return $this->get(PageContainer::class)->getFactory()->create();
}

}

+ 10
- 9
Controller/Ticket/TicketAdminController.php 파일 보기

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

namespace Lc\SovBundle\Controller\Ticket;

use Doctrine\ORM\EntityManagerInterface;
use EasyCorp\Bundle\EasyAdminBundle\Config\Action;
use EasyCorp\Bundle\EasyAdminBundle\Config\Actions;
use EasyCorp\Bundle\EasyAdminBundle\Config\Assets;
@@ -13,6 +14,7 @@ use EasyCorp\Bundle\EasyAdminBundle\Field\DateField;
use EasyCorp\Bundle\EasyAdminBundle\Field\IntegerField;
use EasyCorp\Bundle\EasyAdminBundle\Field\TextField;
use EasyCorp\Bundle\EasyAdminBundle\Router\AdminUrlGenerator;
use Lc\SovBundle\Container\Ticket\TicketContainer;
use Lc\SovBundle\Factory\Ticket\TicketFactory;
use Lc\SovBundle\Factory\Ticket\TicketFactoryInterface;
use Lc\SovBundle\Factory\Ticket\TicketMessageFactory;
@@ -25,6 +27,7 @@ use Lc\SovBundle\Controller\AbstractAdminController;
use Lc\SovBundle\Model\Ticket\TicketModel;
use Lc\SovBundle\Translation\TranslatorAdmin;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\RequestStack;

class TicketAdminController extends AbstractAdminController
{
@@ -36,8 +39,7 @@ class TicketAdminController extends AbstractAdminController

public function createEntity(string $entityFqcn)
{
$factory = new TicketFactory();
return $factory->create();
return $this->get(TicketContainer::class)->getFactory()->create();
}

public function configureAssets(Assets $assets): Assets
@@ -106,8 +108,8 @@ class TicketAdminController extends AbstractAdminController
if ($form->isSubmitted() && $form->isValid()) {
$ticket = $form->getData();

$this->get('em')->persist($ticket);
$this->get('em')->flush();
$this->get(EntityManagerInterface::class)->create($ticket);
$this->get(EntityManagerInterface::class)->flush();

$url = $adminUrlGenerator
->setAction('index')
@@ -142,17 +144,16 @@ class TicketAdminController extends AbstractAdminController
]
);

$ticketMessageFactory = new TicketMessageFactory();
$ticketMessage = $ticketMessageFactory->create();
$ticketMessage = $this->get(TicketContainer::class)->getFactory()->create();
$formAddTicketMessage = $this->createForm(TicketMessageFormType::class, $ticketMessage);
$formAddTicketMessage->handleRequest($this->get('request')->getMasterRequest());
$formAddTicketMessage->handleRequest($this->get(RequestStack::class)->getMainRequest());

if ($formAddTicketMessage->isSubmitted() && $formAddTicketMessage->isValid()) {
$ticketMessage = $formAddTicketMessage->getData();
$ticketMessage->setTicket($ticket);
$ticketMessage->setAnswerByAdmin(true);
$this->get('em')->persist($ticketMessage);
$this->get('em')->flush();
$this->get(EntityManagerInterface::class)->create($ticketMessage);
$this->get(EntityManagerInterface::class)->flush();
}

return $this->render(

+ 8
- 7
Controller/User/AccountAdminController.php 파일 보기

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

namespace Lc\SovBundle\Controller\User;

use Doctrine\ORM\EntityManagerInterface;
use Lc\SovBundle\Doctrine\EntityManager;
use Lc\SovBundle\Form\User\ChangePasswordFormType;
use Lc\SovBundle\Form\User\ProfileFormType;
@@ -15,11 +16,11 @@ use Symfony\Component\Routing\Annotation\Route;

class AccountAdminController extends AbstractController
{
protected $em;
protected EntityManagerInterface $entityManager;

public function __construct(EntityManager $em)
public function __construct(EntityManagerInterface $entityManager)
{
$this->em = $em;
$this->entityManager = $entityManager;
}

/**
@@ -36,8 +37,8 @@ class AccountAdminController extends AbstractController
if ($form->isSubmitted() && $form->isValid()) {
$user = $form->getData();

$this->em->update($user);
$this->em->flush();
$this->entityManager->update($user);
$this->entityManager->flush();

$this->addFlash('success', new TranslatableMessage('form.account_profile.message.success', [], 'admin'));
}
@@ -67,8 +68,8 @@ class AccountAdminController extends AbstractController

$user->setPassword($passwordEncoder->encodePassword($user, $plainPassword));

$this->em->update($user);
$this->em->flush();
$this->entityManager->update($user);
$this->entityManager->flush();

$this->addFlash('success', new TranslatableMessage('form.account_password.message.success', [], 'admin'));
}

+ 2
- 2
Controller/User/GroupUserAdminController.php 파일 보기

@@ -3,6 +3,7 @@
namespace Lc\SovBundle\Controller\User;

use EasyCorp\Bundle\EasyAdminBundle\Field\TextField;
use Lc\SovBundle\Container\User\GroupUserContainer;
use Lc\SovBundle\Controller\AbstractAdminController;
use Lc\SovBundle\Factory\User\GroupUserFactory;

@@ -19,7 +20,6 @@ abstract class GroupUserAdminController extends AbstractAdminController

public function createEntity(string $entityFqcn)
{
$factory = new GroupUserFactory();
return $factory->create();
return $this->get(GroupUserContainer::class)->getFactory()->create();
}
}

+ 3
- 3
Controller/User/UserAdminController.php 파일 보기

@@ -5,6 +5,7 @@ namespace Lc\SovBundle\Controller\User;
use EasyCorp\Bundle\EasyAdminBundle\Field\ChoiceField;
use EasyCorp\Bundle\EasyAdminBundle\Field\EmailField;
use EasyCorp\Bundle\EasyAdminBundle\Field\TextField;
use Lc\SovBundle\Container\User\UserContainer;
use Lc\SovBundle\Controller\AbstractAdminController;
use Lc\SovBundle\Definition\RolesDefinition;
use Lc\SovBundle\Definition\RolesDefinitionInterface;
@@ -16,7 +17,7 @@ use Symfony\Component\HttpFoundation\Session\SessionInterface;

abstract class UserAdminController extends AbstractAdminController
{
protected $rolesDefinition;
protected RolesDefinitionInterface $rolesDefinition;

public function __construct(
SessionInterface $session,
@@ -44,7 +45,6 @@ abstract class UserAdminController extends AbstractAdminController

public function createEntity(string $entityFqcn)
{
$factory = new UserFactory();
return $factory->create();
return $this->get(UserContainer::class)->getFactory()->create();
}
}

+ 51
- 0
Doctrine/Extension/BlameableNullableTrait.php 파일 보기

@@ -0,0 +1,51 @@
<?php

namespace Lc\SovBundle\Doctrine\Extension;

use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;
use Lc\SovBundle\Model\User\UserInterface;

trait BlameableNullableTrait
{

/**
* @Gedmo\Blameable(on="create")
* @ORM\ManyToOne(targetEntity="Lc\SovBundle\Model\User\UserInterface")
* @ORM\JoinColumn(nullable=true)
*/
protected $createdBy;

/**
* @Gedmo\Blameable(on="update")
* @ORM\ManyToOne(targetEntity="Lc\SovBundle\Model\User\UserInterface")
* @ORM\JoinColumn(nullable=true)
*/
protected $updatedBy;


public function getCreatedBy(): ?UserInterface
{
return $this->createdBy;
}

public function setCreatedBy(?UserInterface $createdBy): self
{
$this->createdBy = $createdBy;

return $this;
}

public function getUpdatedBy(): ?UserInterface
{
return $this->updatedBy;
}

public function setUpdatedBy(?UserInterface $updatedBy): self
{
$this->updatedBy = $updatedBy;

return $this;
}

}

+ 1
- 1
Factory/File/FileFactory.php 파일 보기

@@ -6,7 +6,7 @@ use App\Entity\File\File;
use Lc\SovBundle\Factory\AbstractFactory;
use Lc\SovBundle\Model\File\FileInterface;

class FileFactory extends AbstractFactory implements FileFactoryInterface
class FileFactory extends AbstractFactory
{
public function create(): FileInterface
{

+ 0
- 8
Factory/File/FileFactoryInterface.php 파일 보기

@@ -1,8 +0,0 @@
<?php

namespace Lc\SovBundle\Factory\File;

interface FileFactoryInterface
{

}

+ 1
- 1
Factory/Newsletter/NewsletterFactory.php 파일 보기

@@ -6,7 +6,7 @@ use App\Entity\Newsletter\Newsletter;
use Lc\SovBundle\Factory\AbstractFactory;
use Lc\SovBundle\Model\Newsletter\NewsletterInterface;

class NewsletterFactory extends AbstractFactory implements NewsletterFactoryInterface
class NewsletterFactory extends AbstractFactory
{
public function create(): NewsletterInterface
{

+ 0
- 8
Factory/Newsletter/NewsletterFactoryInterface.php 파일 보기

@@ -1,8 +0,0 @@
<?php

namespace Lc\SovBundle\Factory\Newsletter;

interface NewsletterFactoryInterface
{

}

+ 5
- 2
Factory/Reminder/ReminderFactory.php 파일 보기

@@ -8,8 +8,11 @@ use Lc\SovBundle\Model\Reminder\ReminderInterface;

class ReminderFactory extends AbstractFactory implements ReminderFactoryInterface
{
public function create(string $crudAction = null, string $crudControllerFqcn = null, int $entityId = null): ReminderInterface
{
public function create(
string $crudAction = null,
string $crudControllerFqcn = null,
int $entityId = null
): ReminderInterface {
$reminder = new Reminder();

$reminder->setCrudAction($crudAction);

+ 6
- 4
Model/Setting/EntitySettingTrait.php 파일 보기

@@ -2,9 +2,11 @@

namespace Lc\SovBundle\Model\Setting;

//TODO à déplacer dans un solver

trait EntitySettingTrait
{
public function getSetting($name)
public function getSetting($name): ?SettingModel
{
if ($this->getSettings()) {
foreach ($this->getSettings() as $setting) {
@@ -14,10 +16,10 @@ trait EntitySettingTrait
}
}

return false;
return null;
}

public function getSettingValue($name)
public function getSettingValue($name): ?string
{
if ($this->getSettings()) {
foreach ($this->getSettings() as $setting) {
@@ -27,7 +29,7 @@ trait EntitySettingTrait
}
}

return false;
return null;
}

}

+ 8
- 0
Model/Setting/SettingInterface.php 파일 보기

@@ -0,0 +1,8 @@
<?php

namespace Lc\SovBundle\Model\Setting;

interface SettingInterface
{

}

+ 1
- 12
Model/Setting/SettingModel.php 파일 보기

@@ -8,7 +8,7 @@ use Lc\SovBundle\Model\File\FileInterface;
/**
* @ORM\MappedSuperclass()
*/
abstract class SettingModel
abstract class SettingModel implements SettingInterface
{
/**
* @ORM\Column(type="string", length=63)
@@ -30,17 +30,6 @@ abstract class SettingModel
*/
protected $file;

public function getValue()
{
if ($this->getText()) {
return $this->getText();
} elseif ($this->getDate()) {
return $this->getDate();
} elseif ($this->getFile()) {
return $this->getFile();
}
}

public function getName(): ?string
{
return $this->name;

+ 54
- 0
Model/Site/NewsModel.php 파일 보기

@@ -5,6 +5,8 @@ namespace Lc\SovBundle\Model\Site;
use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;
use Lc\SovBundle\Doctrine\Pattern\AbstractFullEntity;
use Lc\SovBundle\Model\File\FileInterface;
use Lc\SovBundle\Model\Newsletter\NewsletterInterface;

/**
* @ORM\MappedSuperclass()
@@ -18,6 +20,22 @@ abstract class NewsModel extends AbstractFullEntity implements NewsInterface
*/
protected $date;

/**
* @ORM\Column(type="boolean", nullable=true)
*/
protected $isSent;


/**
* @ORM\ManyToOne(targetEntity="Lc\SovBundle\Newsletter\NewsletterInsterface", inversedBy="news")
*/
protected $newsletter;

/**
* @ORM\ManyToOne(targetEntity="Lc\SovBundle\File\FileInsterface", cascade={"persist", "remove"})
*/
protected $image;

public function __toString()
{
return $this->getTitle();
@@ -34,4 +52,40 @@ abstract class NewsModel extends AbstractFullEntity implements NewsInterface

return $this;
}

public function getIsSent(): ?bool
{
return $this->isSent;
}

public function setIsSent(?bool $isSent): self
{
$this->isSent = $isSent;

return $this;
}

public function getImage(): ?FileInterface
{
return $this->image;
}

public function setImage(?FileInterface $image): self
{
$this->image = $image;

return $this;
}

public function getNewsletter(): ?NewsletterInterface
{
return $this->newsletter;
}

public function setNewsletter(?NewsletterInterface $newsletter): self
{
$this->newsletter = $newsletter;

return $this;
}
}

+ 0
- 17
Model/Site/PageModel.php 파일 보기

@@ -10,26 +10,9 @@ use Lc\SovBundle\Doctrine\Pattern\AbstractFullEntity;
*/
abstract class PageModel extends AbstractFullEntity implements PageInterface
{
/**
* @ORM\Column(type="text", nullable=true)
*/
protected $content;

public function __toString()
{
return $this->getTitle();
}

public function getContent(): ?string
{
return $this->content;
}

public function setContent(?string $content): self
{
$this->content = $content;

return $this;
}

}

+ 2
- 14
Model/Ticket/TicketMessageModel.php 파일 보기

@@ -5,6 +5,7 @@ namespace Lc\SovBundle\Model\Ticket;
use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;
use Lc\SovBundle\Doctrine\EntityInterface;
use Lc\SovBundle\Doctrine\Extension\BlameableNullableTrait;
use Lc\SovBundle\Doctrine\Extension\StatusInterface;
use Lc\SovBundle\Doctrine\Extension\StatusTrait;
use Lc\SovBundle\Doctrine\Pattern\AbstractLightEntity;
@@ -15,20 +16,7 @@ use Lc\SovBundle\Doctrine\Pattern\AbstractLightEntity;
abstract class TicketMessageModel extends AbstractLightEntity implements TicketMessageInterface, EntityInterface, StatusInterface
{
use StatusTrait;

/**
* @Gedmo\Blameable(on="create")
* @ORM\ManyToOne(targetEntity="Lc\SovBundle\Model\User\UserInterface")
* @ORM\JoinColumn(nullable=true)
*/
protected $createdBy;

/**
* @Gedmo\Blameable(on="update")
* @ORM\ManyToOne(targetEntity="Lc\SovBundle\Model\User\UserInterface")
* @ORM\JoinColumn(nullable=true)
*/
protected $updatedBy;
use BlameableNullableTrait;

/**
* @ORM\Column(type="text")

+ 4
- 83
Model/Ticket/TicketModel.php 파일 보기

@@ -7,6 +7,7 @@ use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;
use Lc\SovBundle\Doctrine\EntityInterface;
use Lc\SovBundle\Doctrine\Extension\BlameableNullableTrait;
use Lc\SovBundle\Doctrine\Pattern\AbstractLightEntity;
use Lc\SovBundle\Model\User\UserInterface;

@@ -15,6 +16,9 @@ use Lc\SovBundle\Model\User\UserInterface;
*/
abstract class TicketModel extends AbstractLightEntity implements TicketInterface, EntityInterface
{
use BlameableNullableTrait;


const TYPE_TECHNICAL_PROBLEM = 'technical-problem';
const TYPE_GENERAL_QUESTION = 'general-question';

@@ -22,49 +26,6 @@ abstract class TicketModel extends AbstractLightEntity implements TicketInterfac
const TICKET_STATUS_BEING_PROCESSED = 'being-processed';
const TICKET_STATUS_CLOSED = 'closed';


public function getTypeChoices(): array
{
return [
TicketModel::TYPE_GENERAL_QUESTION,
TicketModel::TYPE_TECHNICAL_PROBLEM,
];
}

public function getStatusChoices(): array
{
return [
TicketModel::TICKET_STATUS_OPEN,
TicketModel::TICKET_STATUS_BEING_PROCESSED,
TicketModel::TICKET_STATUS_CLOSED,
];
}


public function getTypeLabel(): string
{
return 'entity.Ticket.fields.typeChoices.'.$this->getType();
}

public function getStatusLabel(): string
{
return 'entity.Ticket.statuChoices.'.$this->getStatus();
}

/**
* @Gedmo\Blameable(on="create")
* @ORM\ManyToOne(targetEntity="Lc\SovBundle\Model\User\UserInterface")
* @ORM\JoinColumn(nullable=true)
*/
protected $createdBy;

/**
* @Gedmo\Blameable(on="update")
* @ORM\ManyToOne(targetEntity="Lc\SovBundle\Model\User\UserInterface")
* @ORM\JoinColumn(nullable=true)
*/
protected $updatedBy;

/**
* @ORM\Column(type="string", length=32)
*/
@@ -121,46 +82,6 @@ abstract class TicketModel extends AbstractLightEntity implements TicketInterfac
$this->ticketMessages = new ArrayCollection();
}

public function getUsername()
{
if ($this->getUser()) {
return $this->getUser()->getName();
} else {
return strtoupper($this->getVisitorLastname()).' '.$this->getVisitorFirstname();
}
}

public function getUserInfosTicket()
{
$user = $this->getUser();
if ($user) {
return '#'.$user->getId().' '.$user->getName().' '.$user->getEmail();
} else {
return strtoupper($this->getVisitorLastname()).' '.$this->getVisitorFirstname().' '.$this->getVisitorEmail(
);
}
}

public function getEmail()
{
if ($this->getUser()) {
return $this->getUser()->getEmail();
} else {
return $this->getVisitorEmail();
}
}

public function getVisitorInfos()
{
return strtoupper($this->getVisitorLastname()).' '.$this->getVisitorFirstname().' ('.$this->getVisitorEmail(
).')';
}

public function getLastMessage()
{
return $this->getTicketMessages()->last();
}

public function getType(): ?string
{
return $this->type;

Model/User/User.php → Model/User/UserModel.php 파일 보기

@@ -2,17 +2,22 @@

namespace Lc\SovBundle\Model\User;

use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Lc\SovBundle\Doctrine\EntityInterface;
use Lc\SovBundle\Doctrine\Extension\DevAliasInterface;
use Lc\SovBundle\Doctrine\Extension\DevAliasTrait;
use Lc\SovBundle\Model\Newsletter\NewsletterInterface;
use Lc\SovBundle\Model\Ticket\TicketInterface;
use Symfony\Component\Security\Core\User\UserInterface;

/**
* @ORM\MappedSuperclass()
*/
abstract class User implements EntityInterface, UserInterface
abstract class UserModel implements EntityInterface, UserInterface, DevAliasInterface
{
use DevAliasTrait;
/**
* @ORM\Column(type="string", length=180, unique=true)
*/
@@ -39,6 +44,20 @@ abstract class User implements EntityInterface, UserInterface
*/
protected $firstname;

/**
* @ORM\Column(type="string", length=20, nullable=true)
*/
protected $phone;
/**
* @ORM\Column(type="boolean", nullable=true)
*/
protected $gender;

/**
* @ORM\Column(type="date", nullable=true)
*/
protected $birthdate;

/**
* @ORM\Column(type="boolean")
*/
@@ -49,37 +68,29 @@ abstract class User implements EntityInterface, UserInterface
*/
protected $groupUsers;

// isUserInGroupVip
public function isInGroupUserVip()
{
return $this->isInGroupByDevAlias('vip') ;
}
/**
* @ORM\OneToMany(targetEntity="Lc\SovBundle\Model\Ticket\TicketInterface", mappedBy="user")
*/
protected $tickets;

// isUserInGroup
public function isInGroupUser(GroupUserInterface $groupUser)
{
return $this->isInGroupByDevAlias($groupUser->getDevAlias());
}
/**
* @ORM\Column(type="array", nullable=true)
*/
protected $ticketTypesNotification = [];

// isUserInGroupByDevAlias
public function isInGroupByDevAlias(string $groupUserDevAlias)
public function __construct()
{
$groupUsers = $this->getGroupUsers();

foreach($groupUsers as $groupUser) {
if($groupUser->getDevAlias() == $groupUserDevAlias) {
return true;
}
}

return false;
$this->tickets = new ArrayCollection();
}

public function isSubscribedToNewsletter(NewsletterInterface $newsletter)
public function __toString()
{
return $this->getNewsletters()->contains($newsletter);
return '#' . $this->getId() . ' ' . strtoupper($this->getLastname()) . ' ' . $this->getFirstname(
) . ' (' . $this->getEmail() . ')';
}



public function getEmail(): ?string
{
return $this->email;
@@ -102,6 +113,33 @@ abstract class User implements EntityInterface, UserInterface
return (string)$this->email;
}



public function getGender(): ?bool
{
return $this->gender;
}

public function setGender(?bool $gender): self
{
$this->gender = $gender;

return $this;
}

public function getBirthdate(): ?\DateTimeInterface
{
return $this->birthdate;
}

public function setBirthdate(\DateTimeInterface $birthdate): self
{
$this->birthdate = $birthdate;

return $this;
}


/**
* @see UserInterface
*/
@@ -142,6 +180,7 @@ abstract class User implements EntityInterface, UserInterface
}


//TODO vérifier si on peut déplacer da Solver
public function generatePassword($length = 8): string
{
$chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
@@ -196,9 +235,16 @@ abstract class User implements EntityInterface, UserInterface
return $this;
}

public function getName(): ?string
public function getPhone(): ?string
{
return $this->phone;
}

public function setPhone(?string $phone): self
{
return $this->getFirstname().' '.strtoupper($this->getLastname());
$this->phone = $phone;

return $this;
}

public function isVerified(): bool
@@ -241,4 +287,50 @@ abstract class User implements EntityInterface, UserInterface
return $this;
}



/**
* @return Collection|TicketInterface[]
*/
public function getTickets(): Collection
{
return $this->tickets;
}

public function addTicket(TicketInterface $ticket): self
{
if (!$this->tickets->contains($ticket)) {
$this->tickets[] = $ticket;
$ticket->setUser($this);
}

return $this;
}

public function removeTicket(TicketInterface $ticket): self
{
if ($this->tickets->contains($ticket)) {
$this->tickets->removeElement($ticket);
// set the owning side to null (unless already changed)
if ($ticket->getUser() === $this) {
$ticket->setUser(null);
}
}

return $this;
}

public function getTicketTypesNotification(): ?array
{
return $this->ticketTypesNotification;
}

public function setTicketTypesNotification(?array $ticketTypesNotification): self
{
$this->ticketTypesNotification = $ticketTypesNotification;

return $this;
}


}

+ 29
- 26
Repository/AbstractRepository.php 파일 보기

@@ -19,16 +19,6 @@ abstract class AbstractRepository extends ServiceEntityRepository implements Ser
$this->defaultLocale = $locale;
}

public function findOneByOldUrl($url)
{
$qb = $this->createQueryBuilder('entity')
->where('entity.oldUrls LIKE :oldUrl')
->andWhere('entity.status = 1')
->setParameter(':oldUrl', '%' . $url . '%');

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

public function getOneOrNullResult(QueryBuilder $qb, $locale = null, $hydrationMode = null)
{
return $this->getTranslatedQuery($qb, $locale)->getOneOrNullResult($hydrationMode);
@@ -75,20 +65,8 @@ abstract class AbstractRepository extends ServiceEntityRepository implements Ser
return $query;
}

public function findBySimilarSlug($slug)
{
$qb = $this->createQueryBuilder('entity')
->select('COUNT(entity.slug) as totalSimilar')
->andWhere('entity.status>=0')
->andWhere('entity.slug LIKE :slug')
->setParameter('slug', $slug)
->groupBy('entity.slug')
->having('COUNT(entity.slug) >=1');

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

public function findAll()
// @TODO : à vérifier si on peut les virer
/*public function findAll()
{
return $this->findBy(array());
}
@@ -109,7 +87,7 @@ abstract class AbstractRepository extends ServiceEntityRepository implements Ser

protected function setCriteria(array $criteria): array
{
/*$className = $this->getClassMetadata()->getName();
$className = $this->getClassMetadata()->getName();
$entity = new $className;

if ($entity instanceof StatusInterface) {
@@ -119,9 +97,34 @@ abstract class AbstractRepository extends ServiceEntityRepository implements Ser
if ($criteria['status'] === false) {
unset($criteria['status']);
}
}*/
}

return $criteria;
}*/

// @TODO : à réécrire dans un Store
/*
public function findBySimilarSlug($slug)
{
$qb = $this->createQueryBuilder('entity')
->select('COUNT(entity.slug) as totalSimilar')
->andWhere('entity.status>=0')
->andWhere('entity.slug LIKE :slug')
->setParameter('slug', $slug)
->groupBy('entity.slug')
->having('COUNT(entity.slug) >=1');

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

public function findOneByOldUrl($url)
{
$qb = $this->createQueryBuilder('entity')
->where('entity.oldUrls LIKE :oldUrl')
->andWhere('entity.status = 1')
->setParameter(':oldUrl', '%' . $url . '%');

return $qb->getQuery()->getOneOrNullResult();
}*/

}

+ 32
- 4
Repository/AbstractRepositoryQuery.php 파일 보기

@@ -5,9 +5,15 @@ namespace Lc\SovBundle\Repository;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\ORM\QueryBuilder;
use Knp\Component\Pager\PaginatorInterface;
use Lc\CaracoleBundle\Model\Merchant\MerchantInterface;
use Lc\CaracoleBundle\Model\Section\SectionInterface;
use Lc\SovBundle\Doctrine\EntityInterface;

abstract class AbstractRepositoryQuery
{
use StatusRepositoryQueryTrait;
use TreeRepositoryQueryTrait;

protected ServiceEntityRepository $repository;
protected QueryBuilder $query;
protected PaginatorInterface $paginator;
@@ -49,14 +55,14 @@ abstract class AbstractRepositoryQuery
public function count(): string
{
return $this->query->getQuery()
->getSingleScalarResult();
->getSingleScalarResult();
}

public function findOne()
public function findOne(): ?EntityInterface
{
return $this->query->getQuery()
->setMaxResults(1)
->getOneOrNullResult();
->setMaxResults(1)
->getOneOrNullResult();
}

public function find(): array
@@ -108,5 +114,27 @@ abstract class AbstractRepositoryQuery
return $this->addOrderBy('.' . $field, $sort);
}
}

public function filterById(int $id)
{
return $this
->andWhere('.id = :id')
->setParameter('id', $id);
}

public function filterByDevAlias(string $devAlias): self
{
return $this
->andWhere('.devAlias = :devAlias')
->setParameter('devAlias', $devAlias);
}

public function filterBySlug(string $slug)
{
return $this
->andWhere('.slug = :slug')
->setParameter('slug', $slug);
}

}


+ 20
- 0
Repository/AbstractStore.php 파일 보기

@@ -2,10 +2,30 @@

namespace Lc\SovBundle\Repository;

use Lc\SovBundle\Model\Site\PageInterface;

abstract class AbstractStore
{
public function createQuery($query = null)
{
if (is_null($query)) {
$query = $this->query->create();
}

return $query;
}

public function getRepositoryQuery()
{
return $this->query;
}

public function getOneById(int $id)
{
$query = $this->query->create();

$query->filterById($id);

return $query->findOne();
}
}

+ 22
- 85
Repository/Reminder/ReminderStore.php 파일 보기

@@ -16,16 +16,14 @@ class ReminderStore extends AbstractStore implements ReminderStoreInterface

public function get($params = [], $query = null)
{
if (is_null($query)) {
$query = $this->query->create();
}
$query = $this->createQuery($query);

$query->filterByDone();

if (array_key_exists('user', $params)) {
$query
->filterByUser($params['user'])
->groupBy('.id');
->filterByUser($params['user'])
->groupBy('.id');
}

if (array_key_exists('crudAction', $params)) {
@@ -48,104 +46,43 @@ class ReminderStore extends AbstractStore implements ReminderStoreInterface
// findByUser
public function getByUser(UserInterface $user, $query = null): array
{
if (is_null($query)) {
$query = $this->query->create();
}
$query = $this->createQuery($query);

$query = $this->query->create();

$query
->filterByUser($user)
->filterIsNotDone()
->orderBy('.dateReminder')
->groupBy('.id');
->filterByUser($user)
->filterIsNotDone()
->orderBy('.dateReminder')
->groupBy('.id');

return $query->find();
}

// findByEasyAdminConfigAndUser
public function getByEasyAdminConfigAndUser(
string $crudAction,
string $crudControllerFqcn,
UserInterface $user,
int $entityId = null,
$query = null
string $crudAction,
string $crudControllerFqcn,
UserInterface $user,
int $entityId = null,
$query = null
): array {
if (is_null($query)) {
$query = $this->query->create();
}
$query = $this->createQuery($query);

$query
->filterByUser($user)
->filterLikeCrudAction($crudAction)
->filterLikeCrudControllerFqcn($crudControllerFqcn)
->filterIsNotDone();
->filterByUser($user)
->filterLikeCrudAction($crudAction)
->filterLikeCrudControllerFqcn($crudControllerFqcn)
->filterIsNotDone();

if ($entityId) {
$query
->filterLikeEntityId($entityId);
->filterLikeEntityId($entityId);
}
$query
->orderBy('.dateReminder')
->groupBy('.id');
->orderBy('.dateReminder')
->groupBy('.id');

return $query->find();
}

// public function findByEasyAdminConfigAndUser($crudAction, $crudControllerFqcn, $user, $entityId = null)
// {
// $qb = $this->createQueryBuilder('e');
// $qb->leftJoin('e.users', 'u');
// $qb->having('COUNT(u.id) = 0');
// $qb->orHaving(':user MEMBER OF e.users');
// $qb->andWhere('e.done = 0');
// $qb->andWhere('e.crudAction LIKE :crudAction');
// $qb->andWhere('e.crudControllerFqcn LIKE :entity');
// $qb->setParameter('crudAction', $crudAction);
// $qb->setParameter('crudControllerFqcn', $crudControllerFqcn);
// $qb->setParameter('user', $user);
// if ($entityId) {
// $qb->andWhere('e.entityId LIKE :id');
// $qb->setParameter('entityId', $entityId);
// }
// $qb->orderBy('e.dateReminder', 'ASC');
// $qb->groupBy('e.id');
//
// return $qb->getQuery()->getResult();
// }
}
/*

public function getRemindersByUser($user)
{
$reminderRepo = $this->em->getRepository(ReminderInterface::class);


$reminders = $reminderRepo->findByUser($user);

$entitiesRepo = array();
$entitiesConfig = array();
if (count($reminders) > 0) {
foreach ($reminders as $reminder) {
if ($reminder->getEntityName()) {
if (!isset($entitiesConfig[$reminder->getEntityName()])) {
$entitiesConfig[$reminder->getEntityName()] = $this->configManager->getEntityConfig($reminder->getEntityName());
}
if ($reminder->getEntityAction() == 'edit' || $reminder->getEntityAction() == 'show') {
if (!isset($entitiesRepo[$reminder->getEntityName()])) {
$entitiesRepo[$reminder->getEntityName()] = $this->em->getRepository($entitiesConfig[$reminder->getEntityName()]['class']);
}

if ($reminder->getEntityId()) {
$reminder->relatedPage = $entitiesRepo[$reminder->getEntityName()]->find($reminder->getEntityId())->__toString();
}
} else {
$reminder->relatedPage = 'Liste de ' . $entitiesConfig[$reminder->getEntityName()]['label'];
}
}
}
}
return $reminders;
}

*/
}

+ 0
- 2
Repository/Site/NewsRepositoryQuery.php 파일 보기

@@ -3,12 +3,10 @@
namespace Lc\SovBundle\Repository\Site;

use Knp\Component\Pager\PaginatorInterface;
use Lc\CaracoleBundle\Repository\StatusRepositoryQueryTrait;
use Lc\SovBundle\Repository\AbstractRepositoryQuery;

class NewsRepositoryQuery extends AbstractRepositoryQuery implements NewsRepositoryQueryInterface
{
use StatusRepositoryQueryTrait;

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

+ 4
- 20
Repository/Site/NewsStore.php 파일 보기

@@ -13,35 +13,19 @@ class NewsStore extends AbstractStore implements NewsStoreInterface
$this->query = $query;
}

//findLatests
// findLatests
public function getLatests(int $maxResults = 0, $query = null): array
{
if (is_null($query)) {
$query = $this->query->create();
}
$query = $this->createQuery($query);

$query
->filterIsOnline()
->orderBy('.date', 'DESC');

if ($maxResults) {
$query
->limit($maxResults);
$query->limit($maxResults);
}

return $query->find();
}

public function findLatests($maxResults = 0)
{
$result = $this->findByMerchantQuery()
->orderBy('e.date', 'DESC');

$result->andWhere('e.status = 1');

if ($maxResults) {
$result->setMaxResults($maxResults);
}

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

+ 0
- 6
Repository/Site/PageRepositoryQuery.php 파일 보기

@@ -12,10 +12,4 @@ class PageRepositoryQuery extends AbstractRepositoryQuery implements PageReposit
parent::__construct($repository, 'r', $paginator);
}

public function filterBySlug(string $slug)
{
return $this
->andWhere('.slug = :slug')
->setParameter('slug', $slug);
}
}

+ 0
- 11
Repository/Site/PageStore.php 파일 보기

@@ -13,15 +13,4 @@ class PageStore extends AbstractStore implements PageStoreInterface
{
$this->query = $query;
}

//findPageBySlug
public function getBySlug(string $slug): ?PageInterface
{
$query = $this->query->create();

$query
->filterBySlug($slug);

return $query->findOne();
}
}

+ 26
- 0
Repository/StatusRepositoryQueryTrait.php 파일 보기

@@ -0,0 +1,26 @@
<?php

namespace Lc\SovBundle\Repository;

trait StatusRepositoryQueryTrait
{
public function filterByStatus(int $status):self
{
return $this->andWhere('.status = :status')->setParameter(':status', $status);
}

public function filterIsOffline():self
{
return $this->andWhere('.status = :status')->setParameter(':status', 0);
}

public function filterIsOnline():self
{
return $this->andWhere('.status = :status')->setParameter(':status', 1);
}

public function filterIsOnlineAndOffline():self
{
return $this->andWhere('.status >= 0');
}
}

+ 2
- 2
Repository/Ticket/TicketRepositoryQuery.php 파일 보기

@@ -23,8 +23,8 @@ class TicketRepositoryQuery extends AbstractRepositoryQuery implements TicketRep
public function filterByStatus($statusArray): self
{
return $this
->andWhere('.status IN (:status)')
->setParameter('status', $statusArray);
->andWhere('.status IN (:status)')
->setParameter('status', $statusArray);
}

public function selectCount(): self

+ 10
- 16
Repository/Ticket/TicketStore.php 파일 보기

@@ -4,6 +4,7 @@ namespace Lc\SovBundle\Repository\Ticket;

use App\Entity\Ticket\Ticket;
use Lc\SovBundle\Model\Ticket\TicketInterface;
use Lc\SovBundle\Model\User\UserInterface;
use Lc\SovBundle\Repository\AbstractStore;

class TicketStore extends AbstractStore implements TicketStoreInterface
@@ -16,23 +17,17 @@ class TicketStore extends AbstractStore implements TicketStoreInterface
}

// getTicketsByUser
public function getByUser($user, $query = null): array
public function getByUser(UserInterface $user, $query = null): array
{
if (is_null($query)) {
$query = $this->query->create();
}

$query = $this->createQuery($query);
$query->filterByUser($user);

return $query->find();
}

// findAllOpen
public function getAllOpen(int $limit = 0, $query = null): array
// findAllOpen
public function getOpen(int $limit = 0, $query = null): array
{
if (is_null($query)) {
$query = $this->query->create();
}
$query = $this->createQuery($query);

$query
->filterByStatus(Ticket::TICKET_STATUS_OPEN)
@@ -42,12 +37,11 @@ class TicketStore extends AbstractStore implements TicketStoreInterface
return $query->find();
}

//countAllOpen
public function countAllOpen($query = null): string
// countAllOpen
public function countOpen($query = null): string
{
if (is_null($query)) {
$query = $this->query->create();
}
$query = $this->createQuery($query);

$query
->selectCount()
->filterByStatus(Ticket::TICKET_STATUS_OPEN);

+ 24
- 0
Repository/TreeRepositoryQueryTrait.php 파일 보기

@@ -0,0 +1,24 @@
<?php

namespace Lc\SovBundle\Repository;

use Lc\SovBundle\Doctrine\EntityInterface;

trait TreeRepositoryQueryTrait
{
public function filterIsParent()
{
return $this->andWhere('.parent is NULL');
}

public function filterIsChildren()
{
return $this->andWhere('.parent is NOT NULL');
}

public function filterByParent(EntityInterface $parent)
{
return $this->andWhere('.parent = :parent')->setParameter('parent', $parent);
}

}

+ 1
- 1
Repository/User/UserRepository.php 파일 보기

@@ -25,7 +25,7 @@ class UserRepository extends AbstractRepository
}

$user->setPassword($newEncodedPassword);
$this->_em->persist($user);
$this->_em->update($user);
$this->_em->flush();
}


+ 16
- 8
Repository/User/UserRepositoryQuery.php 파일 보기

@@ -17,21 +17,29 @@ class UserRepositoryQuery extends AbstractRepositoryQuery implements UserReposit
public function filterByNewsletter(Newsletter $newsletter): self
{
return $this
->andWhere(':newsletter MEMBER OF .newsletters')
->setParameter('newsletter', $newsletter->getId());
->andWhere(':newsletter MEMBER OF .newsletters')
->setParameter('newsletter', $newsletter->getId());
}

public function filterLikeRole(string $role): self
public function filterByRole(string $role): self
{
return $this
->andWhere('.roles LIKE :roles')
->setParameter('roles', '%"' . $role . '"%');
->andWhere('.roles LIKE :roles')
->setParameter('roles', '%"' . $role . '"%');
}

public function filterLikeTicketTypeNotification(string $ticketType): self
public function filterByTicketTypeNotification(string $ticketType): self
{
return $this
->andWhere('.ticketTypesNotification LIKE :ticketType')
->setParameter('ticketType', '%"' . $ticketType . '"%');
->andWhere('.ticketTypesNotification LIKE :ticketType')
->setParameter('ticketType', '%"' . $ticketType . '"%');
}

public function filterByEmail(string $email): self
{
return $this
->andWhere('.email LIKE :email')
->setParameter('email', $email);
}

}

+ 18
- 20
Repository/User/UserStore.php 파일 보기

@@ -14,36 +14,34 @@ class UserStore extends AbstractStore implements UserStoreInterface
$this->query = $query;
}

//findAllByNewsletter
// findAllByNewsletter
public function getByNewsletter(Newsletter $newsletter, $query = null): array
{
if (is_null($query)) {
$query = $this->query->create();
}

$query
->filterByNewsletter($newsletter);

$query = $this->createQuery($query);
$query->filterByNewsletter($newsletter);
return $query->find();
}

//findByRole
public function getByRole(string $role): array
// findByRole
public function getByRole(string $role, $query = null): array
{
$query = $this->query->create();
$query
->filterLikeRole($role);

$query = $this->createQuery($query);
$query->filterByRole($role);
return $query->find();
}

//findByTicketTypesNotification
public function getByTicketTypesNotification(string $ticketType): array
// findByTicketTypesNotification
public function getByTicketTypesNotification(string $ticketType, $query = null): array
{
$query = $this->query->create();
$query
->filterLikeTicketTypeNotification($ticketType);

$query = $this->createQuery($query);
$query->filterByTicketTypeNotification($ticketType);
return $query->find();
}

public function getOneByEmail(string $email, $query = null)
{
$query = $this->createQuery($query);
$query->filterByEmail($email);
return $query->findOne();
}
}

+ 2
- 2
Resolver/UrlResolver.php 파일 보기

@@ -18,12 +18,12 @@ class UrlResolver
$this->parameterBag = $parameterBag;
}

public function isServerLocalhost()
public function isServerLocalhost(): bool
{
return in_array($_SERVER['REMOTE_ADDR'], ['127.0.0.1', '::1']);
}

public function isBot()
public function isBot(): bool
{
if (isset($_SERVER['HTTP_USER_AGENT']) && preg_match(
'/bot|crawl|slurp|spider/i',

+ 21
- 0
Solver/Setting/SettingSolver.php 파일 보기

@@ -0,0 +1,21 @@
<?php

namespace Lc\SovBundle\Solver\Setting;

use Lc\SovBundle\Model\Setting\SettingInterface;
use Lc\SovBundle\Model\Ticket\TicketInterface;
use Lc\SovBundle\Model\Ticket\TicketModel;

class SettingSolver
{
public function getValue(SettingInterface $setting)
{
if ($this->getText()) {
return $this->getText();
} elseif ($this->getDate()) {
return $this->getDate();
} elseif ($this->getFile()) {
return $this->getFile();
}
}
}

+ 76
- 0
Solver/Ticket/TicketSolver.php 파일 보기

@@ -0,0 +1,76 @@
<?php

namespace Lc\SovBundle\Solver\Ticket;

use Lc\SovBundle\Model\Ticket\TicketInterface;
use Lc\SovBundle\Model\Ticket\TicketModel;

class TicketSolver
{
public function getTypeChoices(): array
{
return [
TicketModel::TYPE_GENERAL_QUESTION,
TicketModel::TYPE_TECHNICAL_PROBLEM,
];
}

public function getStatusChoices(): array
{
return [
TicketModel::TICKET_STATUS_OPEN,
TicketModel::TICKET_STATUS_BEING_PROCESSED,
TicketModel::TICKET_STATUS_CLOSED,
];
}

public function getTypeLabel(TicketInterface $ticket): string
{
return 'entity.Ticket.fields.typeChoices.'.$ticket->getType();
}

public function getStatusLabel(TicketInterface $ticket): string
{
return 'entity.Ticket.statuChoices.'.$ticket->getStatus();
}

public function getUsername(TicketInterface $ticket)
{
if ($ticket->getUser()) {
return $ticket->getUser()->getName();
} else {
return strtoupper($ticket->getVisitorLastname()).' '.$ticket->getVisitorFirstname();
}
}

public function getUserInfosTicket(TicketInterface $ticket)
{
$user = $ticket->getUser();
if ($user) {
return '#'.$user->getId().' '.$user->getName().' '.$user->getEmail();
} else {
return strtoupper($ticket->getVisitorLastname()).' '.$ticket->getVisitorFirstname().' '.$ticket->getVisitorEmail(
);
}
}

public function getEmail(TicketInterface $ticket)
{
if ($ticket->getUser()) {
return $ticket->getUser()->getEmail();
} else {
return $ticket->getVisitorEmail();
}
}

public function getVisitorInfos(TicketInterface $ticket)
{
return strtoupper($ticket->getVisitorLastname()).' '.$ticket->getVisitorFirstname().' ('.$ticket->getVisitorEmail(
).')';
}

public function getLastMessage(TicketInterface $ticket)
{
return $ticket->getTicketMessages()->last();
}
}

+ 53
- 0
Solver/User/UserSolver.php 파일 보기

@@ -0,0 +1,53 @@
<?php

namespace Lc\SovBundle\Solver\User;

use Lc\SovBundle\Model\Newsletter\NewsletterInterface;
use Lc\SovBundle\Model\User\GroupUserInterface;
use Lc\SovBundle\Model\User\UserInterface;

class UserSolver
{
// @TODO : à écrire si besoin (voir __toString de UserModel)
public function getSummary(UserInterface $user)
{

}

public function getName(UserInterface $user): ?string
{
return (string) ucfirst(strtolower($user->getFirstname())) . ' ' . strtoupper($user->getLastname());
}


// isUserInGroupVip
public function isInGroupUserVip(UserInterface $user)
{
return $this->isInGroupByDevAlias($user, 'vip') ;
}

// isUserInGroup
public function isInGroupUser(UserInterface $user, GroupUserInterface $groupUser)
{
return $this->isInGroupByDevAlias($user, $groupUser->getDevAlias());
}

// isUserInGroupByDevAlias
public function isInGroupByDevAlias(UserInterface $user, string $groupUserDevAlias)
{
$groupUsers = $user->getGroupUsers();

foreach($groupUsers as $groupUser) {
if($groupUser->getDevAlias() == $groupUserDevAlias) {
return true;
}
}

return false;
}

public function isSubscribedToNewsletter(UserInterface $user, NewsletterInterface $newsletter)
{
return $user->getNewsletters()->contains($newsletter);
}
}

+ 5
- 5
Translation/TranslatorAdmin.php 파일 보기

@@ -7,7 +7,7 @@ use Symfony\Contracts\Translation\TranslatorInterface;

class TranslatorAdmin
{
protected $translator;
protected TranslatorInterface $translator;

const DOMAIN = 'admin';

@@ -16,17 +16,17 @@ class TranslatorAdmin
$this->translator = $translator;
}

public function transAction($action)
public function transAction($action): string
{
return $this->trans('action.' . $action);
}

public function transMenu($menu)
public function transMenu($menu): string
{
return $this->trans('menu.' . $menu);
}

public function transFlashMessage($name, $params = [])
public function transFlashMessage($name, $params = []): string
{
return $this->trans('flash_message.' . $name, $params);
}
@@ -68,7 +68,7 @@ class TranslatorAdmin
);
}

public function transTitle($pageName, $entityClass = null, $params = [])
public function transTitle($pageName, $entityClass = null, $params = []): string
{
$entityName = $this->getEntityName($entityClass);


Loading…
취소
저장