Browse Source

Système Filtres SovBundle

develop
Fab 3 years ago
parent
commit
00ff2ab5d2
100 changed files with 1207 additions and 426 deletions
  1. +12
    -0
      Controller/AbstractAdminController.php
  2. +1
    -1
      Controller/Dashboard/DashboardAdminController.php
  3. +65
    -47
      Controller/Reminder/ReminderAdminController.php
  4. +8
    -4
      Controller/Security/SecurityAdminController.php
  5. +5
    -3
      Controller/Setting/SettingAdminController.php
  6. +6
    -11
      Controller/Ticket/TicketAdminController.php
  7. +9
    -2
      Controller/User/AccountAdminController.php
  8. +0
    -10
      EventSubscriber/SiteSettingEventSubscriber.php
  9. +18
    -0
      Factory/File/FileFactory.php
  10. +8
    -0
      Factory/File/FileFactoryInterface.php
  11. +18
    -0
      Factory/Newsletter/NewsletterFactory.php
  12. +8
    -0
      Factory/Newsletter/NewsletterFactoryInterface.php
  13. +3
    -2
      Factory/Setting/SiteSettingFactory.php
  14. +8
    -0
      Factory/Setting/SiteSettingFactoryInterface.php
  15. +18
    -0
      Factory/Site/NewsFactory.php
  16. +8
    -0
      Factory/Site/NewsFactoryInterface.php
  17. +17
    -0
      Factory/Site/PageFactory.php
  18. +8
    -0
      Factory/Site/PageFactoryInterface.php
  19. +3
    -2
      Factory/Site/SiteFactory.php
  20. +8
    -0
      Factory/Site/SiteFactoryInterface.php
  21. +4
    -3
      Factory/Ticket/TicketFactory.php
  22. +3
    -2
      Factory/Ticket/TicketMessageFactory.php
  23. +8
    -0
      Factory/Ticket/TicketMessageFactoryInterface.php
  24. +17
    -0
      Factory/User/GroupUserFactory.php
  25. +8
    -0
      Factory/User/GroupUserFactoryInterface.php
  26. +2
    -1
      Factory/User/UserFactory.php
  27. +8
    -0
      Factory/User/UserFactoryInterface.php
  28. +0
    -8
      Form/User/ChangePasswordFormType.php
  29. +0
    -8
      Form/User/ProfileFormType.php
  30. +108
    -0
      Maker/FactoryMaker.php
  31. +125
    -0
      Maker/RepositoryMaker.php
  32. +0
    -36
      Model/Site/PageModel.php
  33. +8
    -25
      Repository/AbstractRepository.php
  34. +0
    -6
      Repository/AbstractRepositoryInterface.php
  35. +1
    -0
      Repository/AbstractRepositoryQuery.php
  36. +7
    -12
      Repository/File/FileRepository.php
  37. +14
    -0
      Repository/File/FileRepositoryQuery.php
  38. +8
    -0
      Repository/File/FileRepositoryQueryInterface.php
  39. +13
    -0
      Repository/File/FileStore.php
  40. +8
    -0
      Repository/File/FileStoreInterface.php
  41. +4
    -9
      Repository/Newsletter/NewsletterRepository.php
  42. +14
    -0
      Repository/Newsletter/NewsletterRepositoryQuery.php
  43. +8
    -0
      Repository/Newsletter/NewsletterRepositoryQueryInterface.php
  44. +13
    -0
      Repository/Newsletter/NewsletterStore.php
  45. +8
    -0
      Repository/Newsletter/NewsletterStoreInterface.php
  46. +2
    -3
      Repository/Reminder/ReminderRepository.php
  47. +0
    -56
      Repository/Reminder/ReminderRepositoryBack.php
  48. +64
    -1
      Repository/Reminder/ReminderRepositoryQuery.php
  49. +8
    -0
      Repository/Reminder/ReminderRepositoryQueryInterface.php
  50. +63
    -15
      Repository/Reminder/ReminderStore.php
  51. +8
    -0
      Repository/Reminder/ReminderStoreInterface.php
  52. +4
    -9
      Repository/Setting/SiteSettingRepository.php
  53. +14
    -0
      Repository/Setting/SiteSettingRepositoryQuery.php
  54. +8
    -0
      Repository/Setting/SiteSettingRepositoryQueryInterface.php
  55. +13
    -0
      Repository/Setting/SiteSettingStore.php
  56. +8
    -0
      Repository/Setting/SiteSettingStoreInterface.php
  57. +4
    -9
      Repository/Site/NewsRepository.php
  58. +14
    -0
      Repository/Site/NewsRepositoryQuery.php
  59. +8
    -0
      Repository/Site/NewsRepositoryQueryInterface.php
  60. +13
    -0
      Repository/Site/NewsStore.php
  61. +8
    -0
      Repository/Site/NewsStoreInterface.php
  62. +4
    -9
      Repository/Site/PageRepository.php
  63. +14
    -0
      Repository/Site/PageRepositoryQuery.php
  64. +8
    -0
      Repository/Site/PageRepositoryQueryInterface.php
  65. +13
    -0
      Repository/Site/PageStore.php
  66. +8
    -0
      Repository/Site/PageStoreInterface.php
  67. +5
    -11
      Repository/Site/SiteRepository.php
  68. +14
    -0
      Repository/Site/SiteRepositoryQuery.php
  69. +8
    -0
      Repository/Site/SiteRepositoryQueryInterface.php
  70. +13
    -0
      Repository/Site/SiteStore.php
  71. +8
    -0
      Repository/Site/SiteStoreInterface.php
  72. +4
    -11
      Repository/Ticket/TicketMessageRepository.php
  73. +14
    -0
      Repository/Ticket/TicketMessageRepositoryQuery.php
  74. +8
    -0
      Repository/Ticket/TicketMessageRepositoryQueryInterface.php
  75. +13
    -0
      Repository/Ticket/TicketMessageStore.php
  76. +8
    -0
      Repository/Ticket/TicketMessageStoreInterface.php
  77. +4
    -11
      Repository/Ticket/TicketRepository.php
  78. +14
    -0
      Repository/Ticket/TicketRepositoryQuery.php
  79. +8
    -0
      Repository/Ticket/TicketRepositoryQueryInterface.php
  80. +13
    -0
      Repository/Ticket/TicketStore.php
  81. +8
    -0
      Repository/Ticket/TicketStoreInterface.php
  82. +4
    -11
      Repository/User/GroupUserRepository.php
  83. +14
    -0
      Repository/User/GroupUserRepositoryQuery.php
  84. +8
    -0
      Repository/User/GroupUserRepositoryQueryInterface.php
  85. +13
    -0
      Repository/User/GroupUserStore.php
  86. +8
    -0
      Repository/User/GroupUserStoreInterface.php
  87. +22
    -57
      Repository/User/UserRepository.php
  88. +14
    -0
      Repository/User/UserRepositoryQuery.php
  89. +8
    -0
      Repository/User/UserRepositoryQueryInterface.php
  90. +13
    -0
      Repository/User/UserStore.php
  91. +8
    -0
      Repository/User/UserStoreInterface.php
  92. +0
    -0
      Resources/assets/app/admin/reminder/app.reminder.js
  93. +10
    -0
      Resources/assets/app/admin/reminder/reminder.js
  94. +5
    -0
      Resources/assets/app/admin/reminder/reminder.scss
  95. +0
    -0
      Resources/assets/app/admin/ticket/app.ticket.js
  96. +0
    -0
      Resources/assets/app/admin/ticket/ticket.js
  97. +3
    -31
      Resources/config/routes.yaml
  98. +4
    -0
      Resources/config/services.yaml
  99. +17
    -0
      Resources/maker/factory/factory.tpl.php
  100. +8
    -0
      Resources/maker/factory/factory_interface.tpl.php

+ 12
- 0
Controller/AbstractAdminController.php View File

); );
} }


public function createEntity(string $entityFqcn)
{
if(method_exists($this, 'getEntityFactory')) {
$factoryClass = $this->getEntityFactory();
$factory = new $factoryClass;
return $factory->create();
}
else {
return parent::createEntity($entityFqcn);
}
}

public function updateEntity(EntityManagerInterface $entityManager, $entityInstance): void public function updateEntity(EntityManagerInterface $entityManager, $entityInstance): void
{ {
$entityManager->update($entityInstance); $entityManager->update($entityInstance);

+ 1
- 1
Controller/Dashboard/DashboardAdminController.php View File

$assets->addWebpackEncoreEntry('adminlte-sort'); $assets->addWebpackEncoreEntry('adminlte-sort');
$assets->addWebpackEncoreEntry('adminlte-field-collection'); $assets->addWebpackEncoreEntry('adminlte-field-collection');
$assets->addWebpackEncoreEntry('adminlte-field-filemanager'); $assets->addWebpackEncoreEntry('adminlte-field-filemanager');
$assets->addWebpackEncoreEntry('adminlte-reminder');
$assets->addWebpackEncoreEntry('sov-reminder');


return $assets; return $assets;
} }

+ 65
- 47
Controller/Reminder/ReminderAdminController.php View File

use Lc\CaracoleBundle\Resolver\SectionResolver; use Lc\CaracoleBundle\Resolver\SectionResolver;
use Lc\SovBundle\Factory\Reminder\ReminderFactoryInterface; use Lc\SovBundle\Factory\Reminder\ReminderFactoryInterface;
use Lc\SovBundle\Form\Reminder\ReminderAdminFormType; use Lc\SovBundle\Form\Reminder\ReminderAdminFormType;
use Lc\SovBundle\Repository\Reminder\ReminderRepositoryQueryInterface;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface; use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
use Symfony\Component\Form\FormFactoryInterface; use Symfony\Component\Form\FormFactoryInterface;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface; use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
use Symfony\Component\Routing\Annotation\Route;


class ReminderAdminController extends AbstractController class ReminderAdminController extends AbstractController
{ {


protected EntityManagerInterface $entityManager; protected EntityManagerInterface $entityManager;
protected ReminderFactoryInterface $reminderFactory; protected ReminderFactoryInterface $reminderFactory;
protected ReminderRepositoryQueryInterface $reminderRepositoryQuery;
protected FormFactoryInterface $formFactory; protected FormFactoryInterface $formFactory;
protected UrlGeneratorInterface $urlGenerator; protected UrlGeneratorInterface $urlGenerator;
protected MerchantResolver $merchantResolver; protected MerchantResolver $merchantResolver;
public function __construct( public function __construct(
EntityManagerInterface $entityManager, EntityManagerInterface $entityManager,
ReminderFactoryInterface $reminderFactory, ReminderFactoryInterface $reminderFactory,
ReminderRepositoryQueryInterface $reminderRepositoryQuery,
FormFactoryInterface $formFactory, FormFactoryInterface $formFactory,
UrlGeneratorInterface $urlGenerator, UrlGeneratorInterface $urlGenerator,
MerchantResolver $merchantResolver, MerchantResolver $merchantResolver,
) { ) {
$this->entityManager = $entityManager; $this->entityManager = $entityManager;
$this->reminderFactory = $reminderFactory; $this->reminderFactory = $reminderFactory;
$this->reminderRepositoryQuery = $reminderRepositoryQuery;
$this->formFactory = $formFactory; $this->formFactory = $formFactory;
$this->urlGenerator = $urlGenerator; $this->urlGenerator = $urlGenerator;
$this->merchantResolver = $merchantResolver; $this->merchantResolver = $merchantResolver;
$this->parameterBag = $parameterBag; $this->parameterBag = $parameterBag;
} }


/**
* @Route("/admin/reminder/modal", name="sov_admin_reminder_render_modal")
*/
public function renderModal(Request $request): Response public function renderModal(Request $request): Response
{ {
$crudAction = $request->get('crudAction');
$crudControllerFqcn = $request->get('crudControllerFqcn');
$entityId = $request->get('entityId');

$reminder = $this->createEntity($crudAction, $crudControllerFqcn, $entityId);
$id = $request->get('id');

if($id) {
$reminder = $this->reminderRepositoryQuery->getRepository()->find($id);
$action = $this->urlGenerator->generate(
$this->parameterBag->get('app.reminder.route_edit'),
['id' => $id]
);
}
else {
$crudAction = $request->get('crudAction');
$crudControllerFqcn = $request->get('crudControllerFqcn');
$entityId = $request->get('entityId') ? $request->get('entityId') : null ;
$reminder = $this->createEntity($crudAction, $crudControllerFqcn, $entityId);
$action = $this->urlGenerator->generate(
$this->parameterBag->get('app.reminder.route_new')
);
}


$form = $this->formFactory->create( $form = $this->formFactory->create(
ReminderAdminFormType::class, ReminderAdminFormType::class,
$reminder, $reminder,
[ [
'action' => $this->urlGenerator->generate(
$this->parameterBag->get('app.reminder.route_new')
)
'action' => $action
] ]
); );


); );
} }


/**
* @Route("/admin/reminder/new", name="sov_admin_reminder_new")
*/
public function new(Request $request) public function new(Request $request)
{ {
$reminder = $this->createEntity(); $reminder = $this->createEntity();
return $this->redirect($request->headers->get('referer')); return $this->redirect($request->headers->get('referer'));
} }


public function createEntity(string $crudAction = null, string $crudControllerFqcn = null, int $entityId = null)
/**
* @Route("/admin/reminder/edit/{id}", name="sov_admin_reminder_edit")
*/
public function edit(Request $request)
{ {
return $this->reminderFactory->create($crudAction, $crudControllerFqcn, $entityId);
}
$id = $request->get('id');
$reminder = $this->reminderRepositoryQuery->getRepository()->find($id);


$form = $this->formFactory->create(ReminderAdminFormType::class, $reminder);
$form->handleRequest($request);


/*
public function renderTemplate($actionName, $templatePath, array $parameters = [])
{
if ($this->request->isXmlHttpRequest() && ($actionName == 'new' || $actionName == 'edit')) {
$response['flashMessages'] = $this->utils->getFlashMessages();
if ($form->isSubmitted() && $form->isValid()) {
$reminder = $form->getData();
$this->entityManager->update($reminder);
$this->entityManager->flush();


$response['data'] = $this->render('@LcShop/backend/default/modal/edit_reminder.twig', $parameters)->getContent();
return new Response(json_encode($response));
} else {
return parent::renderTemplate($actionName, $templatePath, $parameters);
$this->addFlash('success', 'Le pense-bête a bien été mis à jour');
} }

return $this->redirect($request->headers->get('referer'));
} }


protected function redirectToReferrer()
/**
* @Route("/admin/reminder/done", name="sov_admin_reminder_done")
*/
public function done(Request $request): JsonResponse
{ {
$action = $this->request->query->get('action');

if ($action == 'new') {
$this->utils->addFlash('success', 'success.reminder.add');
} elseif ($action == 'edit') {
$this->utils->addFlash('success', 'success.reminder.edit');
} elseif ($action == ' setReminderDone') {
$this->utils->addFlash('success', 'success.reminder.done');
}
$id = $request->get('id');
$reminder = $this->reminderRepositoryQuery->getRepository()->find($id);
$done = $request->get('done');


if ($this->request->isXmlHttpRequest()) {
$response['flashMessages'] = $this->utils->getFlashMessages();
return new Response(json_encode($response));
} else {
return parent::redirectToReferrer();
if($done == 'true') {
$reminder->setDone(true);
}
else {
$reminder->setDone(false);
} }

$this->entityManager->update($reminder);
$this->entityManager->flush();
return new JsonResponse(['success' => true]);
} }


public function setReminderDoneAction()
public function createEntity(string $crudAction = null, string $crudControllerFqcn = null, int $entityId = null)
{ {
$id = $this->request->query->get('id');
$done = $this->request->query->get('done');

$easyadmin = $this->request->attributes->get('easyadmin');
$reminder = $easyadmin['item'];

$reminder->setDone($done);
$this->em->persist($reminder);
$this->em->flush();
return $this->redirectToReferrer();
}*/
return $this->reminderFactory->create($crudAction, $crudControllerFqcn, $entityId);
}
} }

+ 8
- 4
Controller/Security/SecurityAdminController.php View File



class SecurityAdminController extends AbstractController class SecurityAdminController extends AbstractController
{ {

/**
* @Route("/login", name="sov_login")
*/
public function login(AuthenticationUtils $authenticationUtils): Response public function login(AuthenticationUtils $authenticationUtils): Response
{ {
if ($this->getUser()) { if ($this->getUser()) {
return $this->redirectToRoute('admin_dashboard');
return $this->redirectToRoute('app_admin_dashboard');
} }


// get the login error if there is one // get the login error if there is one
'csrf_token_intention' => 'authenticate', 'csrf_token_intention' => 'authenticate',


// the URL users are redirected to after the login (default: '/admin') // the URL users are redirected to after the login (default: '/admin')
'target_path' => $this->generateUrl('admin_dashboard'),
'target_path' => $this->generateUrl('app_admin_dashboard'),


// the label displayed for the username form field (the |trans filter is applied to it) // the label displayed for the username form field (the |trans filter is applied to it)
'username_label' => 'Your username', 'username_label' => 'Your username',
]); ]);
} }



/**
* @Route("/logout", name="sov_logout")
*/
public function logout() public function logout()
{ {
throw new \LogicException('This method can be blank - it will be intercepted by the logout key on your firewall.'); throw new \LogicException('This method can be blank - it will be intercepted by the logout key on your firewall.');

+ 5
- 3
Controller/Setting/SettingAdminController.php View File

namespace Lc\SovBundle\Controller\Setting; namespace Lc\SovBundle\Controller\Setting;


use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\EntityManagerInterface;
use Lc\CaracoleBundle\Form\Setting\MerchantSettingsFormType;
use Lc\CaracoleBundle\Form\Setting\SectionSettingsFormType;
use Lc\SovBundle\Definition\SiteSettingDefinitionInterface; use Lc\SovBundle\Definition\SiteSettingDefinitionInterface;
use Lc\SovBundle\Form\Setting\SiteSettingsFormType; use Lc\SovBundle\Form\Setting\SiteSettingsFormType;
use Lc\SovBundle\Repository\Setting\SiteSettingRepository; use Lc\SovBundle\Repository\Setting\SiteSettingRepository;
use Lc\SovBundle\Translation\TranslatorAdmin; use Lc\SovBundle\Translation\TranslatorAdmin;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Routing\Annotation\Route;


class SettingAdminController extends AbstractController class SettingAdminController extends AbstractController
{ {
$this->siteRepository = $siteRepository; $this->siteRepository = $siteRepository;
} }


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


return $this->render( return $this->render(
'@LcSov/admin/setting/global.html.twig' ,
'@LcSov/admin/setting/edit_site.html.twig' ,
[ [
'setting_definition' => $this->siteSettingDefinition, 'setting_definition' => $this->siteSettingDefinition,
'form' => $form->createView() 'form' => $form->createView()

+ 6
- 11
Controller/Ticket/TicketAdminController.php View File

use EasyCorp\Bundle\EasyAdminBundle\Field\TextField; use EasyCorp\Bundle\EasyAdminBundle\Field\TextField;
use EasyCorp\Bundle\EasyAdminBundle\Router\AdminUrlGenerator; use EasyCorp\Bundle\EasyAdminBundle\Router\AdminUrlGenerator;
use Lc\SovBundle\Factory\Ticket\TicketFactoryInterface; use Lc\SovBundle\Factory\Ticket\TicketFactoryInterface;
use Lc\SovBundle\Factory\Ticket\TicketMessageFactory;
use Lc\SovBundle\Factory\Ticket\TicketMessageFactoryInterface;
use Lc\SovBundle\Form\Ticket\TicketFormType; use Lc\SovBundle\Form\Ticket\TicketFormType;
use Lc\SovBundle\Form\Ticket\TicketMessageFormType; use Lc\SovBundle\Form\Ticket\TicketMessageFormType;
use Lc\SovBundle\Form\Ticket\TicketStatusType; use Lc\SovBundle\Form\Ticket\TicketStatusType;
{ {
$assets = parent::configureAssets($assets); $assets = parent::configureAssets($assets);


$assets->addWebpackEncoreEntry('adminlte-ticket');
$assets->addWebpackEncoreEntry('sov-ticket');


return $assets; return $assets;
} }
DateField::new('createdAt')->setFormat('short') DateField::new('createdAt')->setFormat('short')
->hideOnForm(), ->hideOnForm(),
TextField::new('visitorFirstName') TextField::new('visitorFirstName')
->setTemplatePath('@LcSov/admin/ticket/index_username.html.twig')
->setTemplatePath('@LcSov/admin/ticket/field/username.html.twig')
->hideOnForm(), ->hideOnForm(),
TextField::new('visitorEmail') TextField::new('visitorEmail')
->setTemplatePath('@LcSov/admin/ticket/index_email.html.twig')
->setTemplatePath('@LcSov/admin/ticket/field/email.html.twig')
->hideOnForm(), ->hideOnForm(),
AssociationField::new('user') AssociationField::new('user')
->hideOnIndex(), ->hideOnIndex(),
TextField::new('subject'), TextField::new('subject'),
TextField::new('lastMessage') TextField::new('lastMessage')
->setTemplatePath('@LcSov/admin/ticket/index_lastmessage.html.twig')
->setTemplatePath('@LcSov/admin/ticket/field/lastmessage.html.twig')
->hideOnForm(), ->hideOnForm(),
ChoiceField::new('type') ChoiceField::new('type')
->autocomplete() ->autocomplete()
$this->translatorAdmin->transChoices(TicketModel::getStatusChoices(), 'Ticket', 'status') $this->translatorAdmin->transChoices(TicketModel::getStatusChoices(), 'Ticket', 'status')


) )
->setTemplatePath('@LcSov/admin/ticket/index_status.html.twig')
->setTemplatePath('@LcSov/admin/ticket/field/status.html.twig')
->hideOnForm(), ->hideOnForm(),
]; ];
} }
if ($form->isSubmitted() && $form->isValid()) { if ($form->isSubmitted() && $form->isValid()) {
$ticket = $form->getData(); $ticket = $form->getData();


// @TODO : check si ça marche sans
foreach ($ticket->getTicketMessages() as $ticketMessage) {
$this->get('em')->persist($ticketMessage);
}

$this->get('em')->persist($ticket); $this->get('em')->persist($ticket);
$this->get('em')->flush(); $this->get('em')->flush();



+ 9
- 2
Controller/User/AccountAdminController.php View File

use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Security\Core\Encoder\UserPasswordEncoderInterface; use Symfony\Component\Security\Core\Encoder\UserPasswordEncoderInterface;
use Symfony\Component\Translation\TranslatableMessage; use Symfony\Component\Translation\TranslatableMessage;
use Symfony\Component\Routing\Annotation\Route;


class AccountAdminController extends AbstractController class AccountAdminController extends AbstractController
{ {
$this->em = $em; $this->em = $em;
} }


/**
* @Route("/admin/account/profile", name="sov_admin_account_profile")
*/
public function profile(Request $request): Response public function profile(Request $request): Response
{ {
$user = $this->getUser(); $user = $this->getUser();
} }


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


/**
* @Route("/admin/account/password", name="sov_admin_account_password")
*/
public function changePassword(Request $request, UserPasswordEncoderInterface $passwordEncoder): Response public function changePassword(Request $request, UserPasswordEncoderInterface $passwordEncoder): Response
{ {
$user = $this->getUser(); $user = $this->getUser();
} }


return $this->render( return $this->render(
'@LcSov/user/change_password.html.twig',
'@LcSov/admin/user/edit_password.html.twig',
[ [
'entity_class' => User::class, 'entity_class' => User::class,
'form' => $form->createView() 'form' => $form->createView()

+ 0
- 10
EventSubscriber/SiteSettingEventSubscriber.php View File

namespace Lc\SovBundle\EventSubscriber; namespace Lc\SovBundle\EventSubscriber;


use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\EntityManagerInterface;
use Lc\CaracoleBundle\Definition\MerchantSettingDefinitionInterface;
use Lc\CaracoleBundle\Factory\Setting\MerchantSettingFactory;
use Lc\CaracoleBundle\Factory\Setting\SectionSettingFactory;
use Lc\CaracoleBundle\Factory\User\UserMerchantFactory;
use Lc\CaracoleBundle\Model\Section\SectionInterface;
use Lc\CaracoleBundle\Repository\Merchant\MerchantRepository;
use Lc\CaracoleBundle\Definition\SectionSettingDefinitionInterface;
use Lc\CaracoleBundle\Repository\Section\SectionRepository;
use Lc\CaracoleBundle\Resolver\MerchantResolver;
use Lc\SovBundle\Definition\SiteSettingDefinitionInterface; use Lc\SovBundle\Definition\SiteSettingDefinitionInterface;
use Lc\SovBundle\Factory\Setting\SiteSettingFactory; use Lc\SovBundle\Factory\Setting\SiteSettingFactory;
use Lc\SovBundle\Factory\Site\SiteFactory; use Lc\SovBundle\Factory\Site\SiteFactory;
use Lc\SovBundle\Repository\Site\SiteRepository; use Lc\SovBundle\Repository\Site\SiteRepository;
use Symfony\Component\EventDispatcher\EventSubscriberInterface; use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\HttpKernel\KernelEvents; use Symfony\Component\HttpKernel\KernelEvents;
use Symfony\Component\Security\Core\Security;


class SiteSettingEventSubscriber implements EventSubscriberInterface class SiteSettingEventSubscriber implements EventSubscriberInterface
{ {

+ 18
- 0
Factory/File/FileFactory.php View File

<?php

namespace Lc\SovBundle\Factory\File;

use App\Entity\File\File;
use Lc\SovBundle\Factory\AbstractFactory;
use Lc\SovBundle\Model\File\FileInterface;

class FileFactory extends AbstractFactory implements FileFactoryInterface
{
public function create(): FileInterface
{
$file = new File();

return $file;
}

}

+ 8
- 0
Factory/File/FileFactoryInterface.php View File

<?php

namespace Lc\SovBundle\Factory\File;

interface FileFactoryInterface
{

}

+ 18
- 0
Factory/Newsletter/NewsletterFactory.php View File

<?php

namespace Lc\SovBundle\Factory\Newsletter;

use App\Entity\Newsletter\Newsletter;
use Lc\SovBundle\Factory\AbstractFactory;
use Lc\SovBundle\Model\Newsletter\NewsletterInterface;

class NewsletterFactory extends AbstractFactory implements NewsletterFactoryInterface
{
public function create(): NewsletterInterface
{
$newsletter = new Newsletter();

return $newsletter;
}

}

+ 8
- 0
Factory/Newsletter/NewsletterFactoryInterface.php View File

<?php

namespace Lc\SovBundle\Factory\Newsletter;

interface NewsletterFactoryInterface
{

}

+ 3
- 2
Factory/Setting/SiteSettingFactory.php View File



use App\Entity\Setting\SiteSetting; use App\Entity\Setting\SiteSetting;
use Lc\SovBundle\Factory\AbstractFactory; use Lc\SovBundle\Factory\AbstractFactory;
use Lc\SovBundle\Model\Setting\SiteSettingInterface;


class SiteSettingFactory extends AbstractFactory
class SiteSettingFactory extends AbstractFactory implements SiteSettingFactoryInterface
{ {
public function create()
public function create(): SiteSettingInterface
{ {
$siteSetting = new SiteSetting(); $siteSetting = new SiteSetting();



+ 8
- 0
Factory/Setting/SiteSettingFactoryInterface.php View File

<?php

namespace Lc\SovBundle\Factory\Setting;

interface SiteSettingFactoryInterface
{

}

+ 18
- 0
Factory/Site/NewsFactory.php View File

<?php

namespace Lc\SovBundle\Factory\Site;

use App\Entity\Site\News;
use Lc\SovBundle\Factory\AbstractFactory;
use Lc\SovBundle\Model\Site\NewsInterface;

class NewsFactory extends AbstractFactory implements NewsFactoryInterface
{
public function create(): NewsInterface
{
$news = new News();

return $news;
}

}

+ 8
- 0
Factory/Site/NewsFactoryInterface.php View File

<?php

namespace Lc\SovBundle\Factory\Site;

interface NewsFactoryInterface
{

}

+ 17
- 0
Factory/Site/PageFactory.php View File

<?php

namespace Lc\SovBundle\Factory\Site;

use App\Entity\Site\Page;
use Lc\SovBundle\Factory\AbstractFactory;
use Lc\SovBundle\Model\Site\PageInterface;

class PageFactory extends AbstractFactory implements PageFactoryInterface
{
public function create(): PageInterface
{
$page = new Page();

return $page;
}
}

+ 8
- 0
Factory/Site/PageFactoryInterface.php View File

<?php

namespace Lc\SovBundle\Factory\Site;

interface PageFactoryInterface
{

}

+ 3
- 2
Factory/Site/SiteFactory.php View File



use App\Entity\Site\Site; use App\Entity\Site\Site;
use Lc\SovBundle\Factory\AbstractFactory; use Lc\SovBundle\Factory\AbstractFactory;
use Lc\SovBundle\Model\Site\SiteInterface;


class SiteFactory extends AbstractFactory
class SiteFactory extends AbstractFactory implements SiteFactoryInterface
{ {
public function create()
public function create(): SiteInterface
{ {
$site = new Site(); $site = new Site();



+ 8
- 0
Factory/Site/SiteFactoryInterface.php View File

<?php

namespace Lc\SovBundle\Factory\Site;

interface SiteFactoryInterface
{

}

+ 4
- 3
Factory/Ticket/TicketFactory.php View File



use App\Entity\Ticket\Ticket; use App\Entity\Ticket\Ticket;
use Lc\SovBundle\Factory\AbstractFactory; use Lc\SovBundle\Factory\AbstractFactory;
use Lc\SovBundle\Model\Ticket\TicketInterface;


class TicketFactory extends AbstractFactory implements TicketFactoryInterface class TicketFactory extends AbstractFactory implements TicketFactoryInterface
{ {
protected TicketMessageFactory $ticketMessageFactory;
protected TicketMessageFactoryInterface $ticketMessageFactory;


public function __construct(TicketMessageFactory $ticketMessageFactory)
public function __construct(TicketMessageFactoryInterface $ticketMessageFactory)
{ {
$this->ticketMessageFactory = $ticketMessageFactory; $this->ticketMessageFactory = $ticketMessageFactory;
} }


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



+ 3
- 2
Factory/Ticket/TicketMessageFactory.php View File



use App\Entity\Ticket\TicketMessage; use App\Entity\Ticket\TicketMessage;
use Lc\SovBundle\Factory\AbstractFactory; use Lc\SovBundle\Factory\AbstractFactory;
use Lc\SovBundle\Model\Ticket\TicketMessageInterface;


class TicketMessageFactory extends AbstractFactory
class TicketMessageFactory extends AbstractFactory implements TicketMessageFactoryInterface
{ {
public function create()
public function create(): TicketMessageInterface
{ {
$ticketMessage = new TicketMessage(); $ticketMessage = new TicketMessage();



+ 8
- 0
Factory/Ticket/TicketMessageFactoryInterface.php View File

<?php

namespace Lc\SovBundle\Factory\Ticket;

interface TicketMessageFactoryInterface
{

}

+ 17
- 0
Factory/User/GroupUserFactory.php View File

<?php

namespace Lc\SovBundle\Factory\User;

use App\Entity\User\GroupUser;
use Lc\SovBundle\Factory\AbstractFactory;
use Lc\SovBundle\Model\User\GroupUserInterface;

class GroupUserFactory extends AbstractFactory implements GroupUserFactoryInterface
{
public function create(): GroupUserInterface
{
$groupUser = new GroupUser();

return $groupUser;
}
}

+ 8
- 0
Factory/User/GroupUserFactoryInterface.php View File

<?php

namespace Lc\SovBundle\Factory\User;

interface GroupUserFactoryInterface
{

}

+ 2
- 1
Factory/User/UserFactory.php View File



use App\Entity\User\User; use App\Entity\User\User;
use Lc\SovBundle\Factory\AbstractFactory; use Lc\SovBundle\Factory\AbstractFactory;
use Lc\SovBundle\Model\User\UserInterface;


class UserFactory extends AbstractFactory class UserFactory extends AbstractFactory
{ {
public function create()
public function create(): UserInterface
{ {
$user = new User(); $user = new User();



+ 8
- 0
Factory/User/UserFactoryInterface.php View File

<?php

namespace Lc\SovBundle\Factory\User;

interface UserFactoryInterface
{

}

+ 0
- 8
Form/User/ChangePasswordFormType.php View File

'invalid_message' => $this->translatorAdmin->trans('form.account_password.message.invalid_passwords'), 'invalid_message' => $this->translatorAdmin->trans('form.account_password.message.invalid_passwords'),
] ]
); );

$builder->add(
'submit',
SubmitType::class,
array(
'label' => $this->translatorAdmin->transAction('save')
)
);
} }


/** /**

+ 0
- 8
Form/User/ProfileFormType.php View File

TextType::class TextType::class
); );
} }

$builder->add(
'submit',
SubmitType::class,
[
'label' => $this->translatorAdmin->transAction('save')
]
);
} }


/** /**

+ 108
- 0
Maker/FactoryMaker.php View File

<?php

namespace Lc\SovBundle\Maker;

use Doctrine\Common\Annotations\Annotation;
use Symfony\Bundle\MakerBundle\ConsoleStyle;
use Symfony\Bundle\MakerBundle\DependencyBuilder;
use Symfony\Bundle\MakerBundle\Generator;
use Symfony\Bundle\MakerBundle\InputConfiguration;
use Symfony\Bundle\MakerBundle\Maker\AbstractMaker;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;

use function Symfony\Component\String\u;

class FactoryMaker extends AbstractMaker
{
public static function getCommandName(): string
{
return 'make:factory';
}

public static function getCommandDescription(): string
{
return 'Creates a factory';
}

public function configureCommand(Command $command, InputConfiguration $inputConf)
{
$command
/*->addArgument(
'factory-class',
InputArgument::OPTIONAL,
'Choose a name for your factory (e.g. <fg=yellow>MyEntityFactory</>)'
)*/
->addArgument(
'namespace',
InputArgument::OPTIONAL,
'Namespace (e.g. <fg=yellow>Lc\SovBundle\Factory</>)'
)
->addArgument(
'domain',
InputArgument::OPTIONAL,
'Domain (e.g. <fg=yellow>Order</>)'
)
->addArgument(
'entity-class',
InputArgument::OPTIONAL,
'Define the entity (e.g. <fg=yellow>MyEntity</>)'
)
->setHelp('');
}

public function generate(InputInterface $input, ConsoleStyle $io, Generator $generator)
{
$entityDetails = $generator->createClassNameDetails(
$input->getArgument('entity-class'),
'Entity\\',
''
);

$factoryClass = $input->getArgument('entity-class') . 'Factory';
$factoryDetails = $generator->createClassNameDetails(
$factoryClass,
'Factory\\',
''
);

$options = [
'namespace_path' => $input->getArgument('namespace'),
'domain' => $input->getArgument('domain'),
'entity_class' => $input->getArgument('entity-class'),
'entity' => $entityDetails->getFullName(),
'entity_variable' => '$' . u($input->getArgument('entity-class'))->camel()
];

$generator->generateController(
$factoryDetails->getFullName(),
__DIR__ . '/../Resources/maker/factory/factory.tpl.php',
$options
);

$interfaceName = $factoryClass . 'Interface';
$generator->generateFile(
$generator->getRootDirectory() . '/src/Factory/' . $interfaceName . '.php',
__DIR__ . '/../Resources/maker/factory/factory_interface.tpl.php',
[
'namespace_path' => $input->getArgument('namespace'),
'domain' => $input->getArgument('domain'),
'interface_name' => $interfaceName,
]
);

$generator->writeChanges();

$this->writeSuccessMessage($io);
$io->text('Next: Open your new factory class and configure it!');
}

public function configureDependencies(DependencyBuilder $dependencies)
{
$dependencies->addClassDependency(
Annotation::class,
'doctrine/annotations'
);
}
}

+ 125
- 0
Maker/RepositoryMaker.php View File

<?php

namespace Lc\SovBundle\Maker;

use Doctrine\Common\Annotations\Annotation;
use Symfony\Bundle\MakerBundle\ConsoleStyle;
use Symfony\Bundle\MakerBundle\DependencyBuilder;
use Symfony\Bundle\MakerBundle\Generator;
use Symfony\Bundle\MakerBundle\InputConfiguration;
use Symfony\Bundle\MakerBundle\Maker\AbstractMaker;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;

use function Symfony\Component\String\u;

class RepositoryMaker extends AbstractMaker
{
public static function getCommandName(): string
{
return 'make:repository';
}

public static function getCommandDescription(): string
{
return 'Creates a repository, query and store';
}

public function configureCommand(Command $command, InputConfiguration $inputConf)
{
$command
->addArgument(
'namespace',
InputArgument::OPTIONAL,
'Namespace (e.g. <fg=yellow>Lc\SovBundle\Repository</>)'
)
->addArgument(
'domain',
InputArgument::OPTIONAL,
'Domain (e.g. <fg=yellow>Order</>)'
)
->addArgument(
'entity-class',
InputArgument::OPTIONAL,
'Define the entity (e.g. <fg=yellow>MyEntity</>)'
)
->setHelp('');
}

public function generate(InputInterface $input, ConsoleStyle $io, Generator $generator)
{
$entityDetails = $generator->createClassNameDetails(
$input->getArgument('entity-class'),
'Entity\\',
''
);

$options = [
'namespace_path' => $input->getArgument('namespace'),
'domain' => $input->getArgument('domain'),
'entity_class' => $input->getArgument('entity-class'),
'entity' => $entityDetails->getFullName(),
];

// repository
$repositoryClass = $input->getArgument('entity-class') . 'Repository';
$this->generateClass($generator, $repositoryClass, 'Repository\\', 'repository.tpl.php', $options);

// repository query
$repositoryQueryClass = $input->getArgument('entity-class') . 'RepositoryQuery';
$options['class_name_repository'] = $repositoryClass;
$this->generateClass($generator, $repositoryQueryClass, 'Repository\\', 'repository_query.tpl.php', $options);

// store
$storeClass = $input->getArgument('entity-class') . 'Store';
$options['class_name_repository_query'] = $repositoryQueryClass;
$this->generateClass($generator, $storeClass, 'Repository\\', 'store.tpl.php', $options);

// interfaces
$this->generateInterface($input, $generator, $repositoryQueryClass . 'Interface');
$this->generateInterface($input, $generator, $storeClass . 'Interface');

// write files
$generator->writeChanges();

$this->writeSuccessMessage($io);
$io->text('Next: Open your new factory class and configure it!');
}

public function generateClass($generator, $class, $namespacePrefix, $tpl, $options)
{
$repositoryDetails = $generator->createClassNameDetails(
$class,
$namespacePrefix,
''
);
$generator->generateController(
$repositoryDetails->getFullName(),
__DIR__ . '/../Resources/maker/repository/'.$tpl,
$options
);
}

public function generateInterface($input, $generator, $interfaceName)
{
$generator->generateFile(
$generator->getRootDirectory() . '/src/Repository/' . $interfaceName . '.php',
__DIR__ . '/../Resources/maker/repository/interface.tpl.php',
[
'namespace_path' => $input->getArgument('namespace'),
'domain' => $input->getArgument('domain'),
'interface_name' => $interfaceName,
]
);
}


public function configureDependencies(DependencyBuilder $dependencies)
{
$dependencies->addClassDependency(
Annotation::class,
'doctrine/annotations'
);
}
}

+ 0
- 36
Model/Site/PageModel.php View File

*/ */
protected $content; protected $content;


/**
* @ORM\ManyToOne(targetEntity="Lc\CaracoleBundle\Model\Merchant\MerchantInterface", inversedBy="pages")
* @ORM\JoinColumn(nullable=false)
*/
protected $merchant;

/**
* @ORM\ManyToOne(targetEntity="Lc\CaracoleBundle\Model\Section\SectionInterface", inversedBy="pages")
*/
protected $section;


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


public function getMerchant(): ?MerchantInterface
{
return $this->merchant;
}

public function setMerchant(?MerchantInterface $merchant): self
{
$this->merchant = $merchant;

return $this;
}

public function getSection(): ?SectionInterface
{
return $this->section;
}

public function setSection(?SectionInterface $section): self
{
$this->section = $section;

return $this;
}

} }

+ 8
- 25
Repository/AbstractRepository.php View File



namespace Lc\SovBundle\Repository; namespace Lc\SovBundle\Repository;


use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepositoryInterface; use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepositoryInterface;
use Doctrine\ORM\AbstractQuery; use Doctrine\ORM\AbstractQuery;
use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\EntityRepository;
use Doctrine\ORM\Query; use Doctrine\ORM\Query;
use Doctrine\ORM\QueryBuilder; use Doctrine\ORM\QueryBuilder;
use Gedmo\Translatable\TranslatableListener; use Gedmo\Translatable\TranslatableListener;
use Lc\CaracoleBundle\Doctrine\Extension\FilterMerchantInterface;
use Lc\SovBundle\Doctrine\Extension\StatusInterface;


abstract class AbstractRepository extends EntityRepository implements ServiceEntityRepositoryInterface,
AbstractRepositoryInterface
abstract class AbstractRepository extends ServiceEntityRepository implements ServiceEntityRepositoryInterface,
AbstractRepositoryInterface
{ {

protected $defaultLocale; protected $defaultLocale;


public function setDefaultLocale($locale) public function setDefaultLocale($locale)
$this->defaultLocale = $locale; $this->defaultLocale = $locale;
} }


public function __construct(EntityManagerInterface $entityManager)
{
parent::__construct($entityManager, $entityManager->getClassMetadata($this->getInterfaceClass()));
}

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


return $qb->getQuery()->getOneOrNullResult(); return $qb->getQuery()->getOneOrNullResult();
} }
return $this->getTranslatedQuery($qb, $locale)->getOneOrNullResult($hydrationMode); return $this->getTranslatedQuery($qb, $locale)->getOneOrNullResult($hydrationMode);
} }



public function getResult(QueryBuilder $qb, $locale = null, $hydrationMode = AbstractQuery::HYDRATE_OBJECT) public function getResult(QueryBuilder $qb, $locale = null, $hydrationMode = AbstractQuery::HYDRATE_OBJECT)
{ {
return $this->getTranslatedQuery($qb, $locale)->getResult($hydrationMode); return $this->getTranslatedQuery($qb, $locale)->getResult($hydrationMode);
} }



public function getArrayResult(QueryBuilder $qb, $locale = null) public function getArrayResult(QueryBuilder $qb, $locale = null)
{ {
return $this->getTranslatedQuery($qb, $locale)->getArrayResult(); return $this->getTranslatedQuery($qb, $locale)->getArrayResult();
} }



public function getSingleResult(QueryBuilder $qb, $locale = null, $hydrationMode = null) public function getSingleResult(QueryBuilder $qb, $locale = null, $hydrationMode = null)
{ {
return $this->getTranslatedQuery($qb, $locale)->getSingleResult($hydrationMode); return $this->getTranslatedQuery($qb, $locale)->getSingleResult($hydrationMode);
} }



public function getScalarResult(QueryBuilder $qb, $locale = null) public function getScalarResult(QueryBuilder $qb, $locale = null)
{ {
return $this->getTranslatedQuery($qb, $locale)->getScalarResult(); return $this->getTranslatedQuery($qb, $locale)->getScalarResult();
} }



public function getSingleScalarResult(QueryBuilder $qb, $locale = null) public function getSingleScalarResult(QueryBuilder $qb, $locale = null)
{ {
return $this->getTranslatedQuery($qb, $locale)->getSingleScalarResult(); return $this->getTranslatedQuery($qb, $locale)->getSingleScalarResult();
$qb = $this->createQueryBuilder('entity') $qb = $this->createQueryBuilder('entity')
->select('entity.id, COUNT(entity.slug) as niche') ->select('entity.id, COUNT(entity.slug) as niche')
->andWhere('entity.status>=0') ->andWhere('entity.status>=0')
->andWhere('entity.merchant= :merchant')
->setParameter('merchant', $merchant)
->groupBy('entity.slug') ->groupBy('entity.slug')
->having('COUNT(entity.slug) >1'); ->having('COUNT(entity.slug) >1');


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



public function findAll() public function findAll()
{ {
return $this->findBy(array()); return $this->findBy(array());
return parent::findOneBy($criteria, $orderBy); return parent::findOneBy($criteria, $orderBy);
} }


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


if ($entity instanceof StatusInterface) { if ($entity instanceof StatusInterface) {
if ($criteria['status'] === false) { if ($criteria['status'] === false) {
unset($criteria['status']); unset($criteria['status']);
} }
}
}*/

return $criteria; return $criteria;
} }



} }

+ 0
- 6
Repository/AbstractRepositoryInterface.php View File

interface AbstractRepositoryInterface interface AbstractRepositoryInterface
{ {


/**
* Retourne la class ou l'interface correspondant à ce repository
*
* @return string
*/
public function getInterfaceClass();
} }

+ 1
- 0
Repository/AbstractRepositoryQuery.php View File



return $data; return $data;
} }

} }



+ 7
- 12
Repository/File/FileRepository.php View File



namespace Lc\SovBundle\Repository\File; namespace Lc\SovBundle\Repository\File;


use Lc\SovBundle\Model\File\FileInterface;
use App\Entity\File\File;
use Doctrine\Persistence\ManagerRegistry;
use Lc\SovBundle\Repository\AbstractRepository; use Lc\SovBundle\Repository\AbstractRepository;
/**
* @method FileInterface|null find($id, $lockMode = null, $lockVersion = null)
* @method FileInterface|null findOneBy(array $criteria, array $orderBy = null)
* @method FileInterface[] findAll()
* @method FileInterface[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
*/

class FileRepository extends AbstractRepository class FileRepository extends AbstractRepository
{ {
public function getInterfaceClass()
{
return FileInterface::class;
}

public function __construct(ManagerRegistry $registry)
{
parent::__construct($registry, File::class);
}
} }

+ 14
- 0
Repository/File/FileRepositoryQuery.php View File

<?php

namespace Lc\SovBundle\Repository\File;

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

class FileRepositoryQuery extends AbstractRepositoryQuery implements FileRepositoryQueryInterface
{
public function __construct(FileRepository $repository, PaginatorInterface $paginator)
{
parent::__construct($repository, 'r', $paginator);
}
}

+ 8
- 0
Repository/File/FileRepositoryQueryInterface.php View File

<?php

namespace Lc\SovBundle\Repository\File;

interface FileRepositoryQueryInterface
{

}

+ 13
- 0
Repository/File/FileStore.php View File

<?php

namespace Lc\SovBundle\Repository\File;

class FileStore implements FileStoreInterface
{
protected FileRepositoryQueryInterface $query;

public function __construct(FileRepositoryQueryInterface $query)
{
$this->query = $query;
}
}

+ 8
- 0
Repository/File/FileStoreInterface.php View File

<?php

namespace Lc\SovBundle\Repository\File;

interface FileStoreInterface
{

}

+ 4
- 9
Repository/Newsletter/NewsletterRepository.php View File



namespace Lc\SovBundle\Repository\Newsletter; namespace Lc\SovBundle\Repository\Newsletter;


use Lc\SovBundle\Model\Newsletter\NewsletterInterface;
use App\Entity\Newsletter\Newsletter;
use Doctrine\Persistence\ManagerRegistry;
use Lc\SovBundle\Repository\AbstractRepository; use Lc\SovBundle\Repository\AbstractRepository;


/**
* @method NewsletterInterface|null find($id, $lockMode = null, $lockVersion = null)
* @method NewsletterInterface|null findOneBy(array $criteria, array $orderBy = null)
* @method NewsletterInterface[] findAll()
* @method NewsletterInterface[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
*/
class NewsletterRepository extends AbstractRepository class NewsletterRepository extends AbstractRepository
{ {
public function getInterfaceClass()
public function __construct(ManagerRegistry $registry)
{ {
return NewsletterInterface::class;
parent::__construct($registry, Newsletter::class);
} }
} }

+ 14
- 0
Repository/Newsletter/NewsletterRepositoryQuery.php View File

<?php

namespace Lc\SovBundle\Repository\Newsletter;

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

class NewsletterRepositoryQuery extends AbstractRepositoryQuery implements NewsletterRepositoryQueryInterface
{
public function __construct(NewsletterRepository $repository, PaginatorInterface $paginator)
{
parent::__construct($repository, 'r', $paginator);
}
}

+ 8
- 0
Repository/Newsletter/NewsletterRepositoryQueryInterface.php View File

<?php

namespace Lc\SovBundle\Repository\Newsletter;

interface NewsletterRepositoryQueryInterface
{

}

+ 13
- 0
Repository/Newsletter/NewsletterStore.php View File

<?php

namespace Lc\SovBundle\Repository\Newsletter;

class NewsletterStore implements NewsletterStoreInterface
{
protected NewsletterRepositoryQueryInterface $query;

public function __construct(NewsletterRepositoryQueryInterface $query)
{
$this->query = $query;
}
}

+ 8
- 0
Repository/Newsletter/NewsletterStoreInterface.php View File

<?php

namespace Lc\SovBundle\Repository\Newsletter;

interface NewsletterStoreInterface
{

}

+ 2
- 3
Repository/Reminder/ReminderRepository.php View File

namespace Lc\SovBundle\Repository\Reminder; namespace Lc\SovBundle\Repository\Reminder;


use App\Entity\Reminder\Reminder; use App\Entity\Reminder\Reminder;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepositoryInterface;
use Doctrine\Persistence\ManagerRegistry; use Doctrine\Persistence\ManagerRegistry;
use Lc\SovBundle\Repository\AbstractRepository;


class ReminderRepository extends ServiceEntityRepository implements ServiceEntityRepositoryInterface
class ReminderRepository extends AbstractRepository
{ {
public function __construct(ManagerRegistry $registry) public function __construct(ManagerRegistry $registry)
{ {

+ 0
- 56
Repository/Reminder/ReminderRepositoryBack.php View File

<?php

namespace Lc\SovBundle\Repository\Reminder;

use Lc\SovBundle\Repository\AbstractRepository;
use Lc\SovBundle\Model\Reminder\ReminderInterface;

/**
* @method ReminderInterface|null find($id, $lockMode = null, $lockVersion = null)
* @method ReminderInterface|null findOneBy(array $criteria, array $orderBy = null)
* @method ReminderInterface[] findAll()
* @method ReminderInterface[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
*/
class ReminderRepositoryBack extends AbstractRepository
{
public function getInterfaceClass()
{
return ReminderInterface::class;
}

public function findByUser($user)
{
$qb = $this->createQueryBuilder('e')
->leftJoin('e.users', 'u')
->having('COUNT(u.id) = 0')
->orHaving(':user MEMBER OF e.users')
->andWhere('e.done = 0')
->setParameter('user', $user)
->orderBy('e.dateReminder', 'ASC')
->groupBy('e.id');

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

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

+ 64
- 1
Repository/Reminder/ReminderRepositoryQuery.php View File

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


class ReminderRepositoryQuery extends AbstractRepositoryQuery
class ReminderRepositoryQuery extends AbstractRepositoryQuery implements ReminderRepositoryQueryInterface
{ {
public function __construct(ReminderRepository $repository, PaginatorInterface $paginator) public function __construct(ReminderRepository $repository, PaginatorInterface $paginator)
{ {
parent::__construct($repository, 'r', $paginator); parent::__construct($repository, 'r', $paginator);
} }

public function filterDone($done = false)
{
return $this
->andWhere('.done = :done')
->setParameter(':done', $done);
}

public function filterUser($user)
{
return $this
->leftJoin('.users', 'u')
->having('COUNT(u.id) = 0')
->orHaving(':user MEMBER OF .users')
->setParameter(':user', $user)
->groupBy('.id');
}

public function filterCrudAction($crudAction)
{
if(is_null($crudAction)) {
return $this
->andWhere('.crudControllerFqcn IS NULL');
}
else {
return $this
->andWhere('.crudAction = :crudAction')
->setParameter(':crudAction', $crudAction);
}
}

public function filterCrudControllerFqcn($crudControllerFqcn)
{
if(is_null($crudControllerFqcn)) {
return $this
->andWhere('.crudControllerFqcn IS NULL');
}
else {
return $this
->andWhere('.crudControllerFqcn = :crudControllerFqcn')
->setParameter(':crudControllerFqcn', $crudControllerFqcn);
}
}

public function filterEntityId($entityId)
{
if(is_null($entityId)) {
return $this
->andWhere('.entityId IS NULL');
}
else {
return $this
->andWhere('.entityId = :entityId')
->setParameter(':entityId', $entityId);
}
}

public function orderDefault()
{
return $this
->orderBy('.dateReminder', 'ASC');
}

} }

+ 8
- 0
Repository/Reminder/ReminderRepositoryQueryInterface.php View File

<?php

namespace Lc\SovBundle\Repository\Reminder;

interface ReminderRepositoryQueryInterface
{

}

+ 63
- 15
Repository/Reminder/ReminderStore.php View File



namespace Lc\SovBundle\Repository\Reminder; namespace Lc\SovBundle\Repository\Reminder;


/**
* class ReminderStore.
*
* @author Simon Vieille <simon@deblan.fr>
*/
class ReminderStore
class ReminderStore implements ReminderStoreInterface
{ {
protected ReminderRepositoryQuery $query;
protected ReminderRepositoryQueryInterface $query;


public function __construct(ReminderRepositoryQuery $query)
public function __construct(ReminderRepositoryQueryInterface $query)
{ {
$this->query = $query; $this->query = $query;
} }


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


return $query
->useCustomFilters()
->andWhere('.description = :description')
->setParameter(':description', 'ahah')
->findOne();
$query->filterDone();

if(array_key_exists('user', $params)) {
$query->filterUser($params['user']);
}

if(array_key_exists('crudAction', $params)) {
$query->filterCrudAction($params['crudAction']);
}

if(array_key_exists('crudControllerFqcn', $params)) {
$query->filterCrudControllerFqcn($params['crudControllerFqcn']);
}

if(array_key_exists('entityId', $params)) {
$query->filterEntityId($params['entityId']);
}

$query->orderDefault();

return $query->find();
}

/*
public function findByUser($user)
{
$qb = $this->createQueryBuilder('e')
->leftJoin('e.users', 'u')
->having('COUNT(u.id) = 0')
->orHaving(':user MEMBER OF e.users')
->andWhere('e.done = 0')
->setParameter('user', $user)
->orderBy('e.dateReminder', 'ASC')
->groupBy('e.id');

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

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

+ 8
- 0
Repository/Reminder/ReminderStoreInterface.php View File

<?php

namespace Lc\SovBundle\Repository\Reminder;

interface ReminderStoreInterface
{

}

+ 4
- 9
Repository/Setting/SiteSettingRepository.php View File



namespace Lc\SovBundle\Repository\Setting; namespace Lc\SovBundle\Repository\Setting;


use App\Entity\Setting\SiteSetting;
use Doctrine\Persistence\ManagerRegistry;
use Lc\SovBundle\Repository\AbstractRepository; use Lc\SovBundle\Repository\AbstractRepository;
use Lc\SovBundle\Model\Setting\SiteSettingInterface;


/**
* @method SiteSettingInterface|null find($id, $lockMode = null, $lockVersion = null)
* @method SiteSettingInterface|null findOneBy(array $criteria, array $orderBy = null)
* @method SiteSettingInterface[] findAll()
* @method SiteSettingInterface[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
*/
class SiteSettingRepository extends AbstractRepository class SiteSettingRepository extends AbstractRepository
{ {
public function getInterfaceClass()
public function __construct(ManagerRegistry $registry)
{ {
return SiteSettingInterface::class;
parent::__construct($registry, SiteSetting::class);
} }
} }

+ 14
- 0
Repository/Setting/SiteSettingRepositoryQuery.php View File

<?php

namespace Lc\SovBundle\Repository\Setting;

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

class SiteSettingRepositoryQuery extends AbstractRepositoryQuery implements SiteSettingRepositoryQueryInterface
{
public function __construct(SiteSettingRepository $repository, PaginatorInterface $paginator)
{
parent::__construct($repository, 'r', $paginator);
}
}

+ 8
- 0
Repository/Setting/SiteSettingRepositoryQueryInterface.php View File

<?php

namespace Lc\SovBundle\Repository\Setting;

interface SiteSettingRepositoryQueryInterface
{

}

+ 13
- 0
Repository/Setting/SiteSettingStore.php View File

<?php

namespace Lc\SovBundle\Repository\Setting;

class SiteSettingStore implements SiteSettingStoreInterface
{
protected SiteSettingRepositoryQueryInterface $query;

public function __construct(SiteSettingRepositoryQueryInterface $query)
{
$this->query = $query;
}
}

+ 8
- 0
Repository/Setting/SiteSettingStoreInterface.php View File

<?php

namespace Lc\SovBundle\Repository\Setting;

interface SiteSettingStoreInterface
{

}

+ 4
- 9
Repository/Site/NewsRepository.php View File



namespace Lc\SovBundle\Repository\Site; namespace Lc\SovBundle\Repository\Site;


use Lc\SovBundle\Model\Site\NewsInterface;
use App\Entity\Site\News;
use Doctrine\Persistence\ManagerRegistry;
use Lc\SovBundle\Repository\AbstractRepository; use Lc\SovBundle\Repository\AbstractRepository;


/**
* @method NewsInterface|null find($id, $lockMode = null, $lockVersion = null)
* @method NewsInterface|null findOneBy(array $criteria, array $orderBy = null)
* @method NewsInterface[] findAll()
* @method NewsInterface[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
*/
class NewsRepository extends AbstractRepository class NewsRepository extends AbstractRepository
{ {
public function getInterfaceClass()
public function __construct(ManagerRegistry $registry)
{ {
return NewsInterface::class;
parent::__construct($registry, News::class);
} }
} }

+ 14
- 0
Repository/Site/NewsRepositoryQuery.php View File

<?php

namespace Lc\SovBundle\Repository\Site;

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

class NewsRepositoryQuery extends AbstractRepositoryQuery implements NewsRepositoryQueryInterface
{
public function __construct(NewsRepository $repository, PaginatorInterface $paginator)
{
parent::__construct($repository, 'r', $paginator);
}
}

+ 8
- 0
Repository/Site/NewsRepositoryQueryInterface.php View File

<?php

namespace Lc\SovBundle\Repository\Site;

interface NewsRepositoryQueryInterface
{

}

+ 13
- 0
Repository/Site/NewsStore.php View File

<?php

namespace Lc\SovBundle\Repository\Site;

class NewsStore implements NewsStoreInterface
{
protected NewsRepositoryQueryInterface $query;

public function __construct(NewsRepositoryQueryInterface $query)
{
$this->query = $query;
}
}

+ 8
- 0
Repository/Site/NewsStoreInterface.php View File

<?php

namespace Lc\SovBundle\Repository\Site;

interface NewsStoreInterface
{

}

+ 4
- 9
Repository/Site/PageRepository.php View File



namespace Lc\SovBundle\Repository\Site; namespace Lc\SovBundle\Repository\Site;


use Lc\SovBundle\Model\Site\PageInterface;
use App\Entity\Site\Page;
use Doctrine\Persistence\ManagerRegistry;
use Lc\SovBundle\Repository\AbstractRepository; use Lc\SovBundle\Repository\AbstractRepository;


/**
* @method PageInterface|null find($id, $lockMode = null, $lockVersion = null)
* @method PageInterface|null findOneBy(array $criteria, array $orderBy = null)
* @method PageInterface[] findAll()
* @method PageInterface[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
*/
class PageRepository extends AbstractRepository class PageRepository extends AbstractRepository
{ {
public function getInterfaceClass()
public function __construct(ManagerRegistry $registry)
{ {
return PageInterface::class;
parent::__construct($registry, Page::class);
} }
} }

+ 14
- 0
Repository/Site/PageRepositoryQuery.php View File

<?php

namespace Lc\SovBundle\Repository\Site;

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

class PageRepositoryQuery extends AbstractRepositoryQuery implements PageRepositoryQueryInterface
{
public function __construct(PageRepository $repository, PaginatorInterface $paginator)
{
parent::__construct($repository, 'r', $paginator);
}
}

+ 8
- 0
Repository/Site/PageRepositoryQueryInterface.php View File

<?php

namespace Lc\SovBundle\Repository\Site;

interface PageRepositoryQueryInterface
{

}

+ 13
- 0
Repository/Site/PageStore.php View File

<?php

namespace Lc\SovBundle\Repository\Site;

class PageStore implements PageStoreInterface
{
protected PageRepositoryQueryInterface $query;

public function __construct(PageRepositoryQueryInterface $query)
{
$this->query = $query;
}
}

+ 8
- 0
Repository/Site/PageStoreInterface.php View File

<?php

namespace Lc\SovBundle\Repository\Site;

interface PageStoreInterface
{

}

+ 5
- 11
Repository/Site/SiteRepository.php View File



namespace Lc\SovBundle\Repository\Site; namespace Lc\SovBundle\Repository\Site;


use Lc\SovBundle\Model\File\FileInterface;
use Lc\SovBundle\Model\Site\SiteInterface;
use App\Entity\Site\Site;
use Doctrine\Persistence\ManagerRegistry;
use Lc\SovBundle\Repository\AbstractRepository; use Lc\SovBundle\Repository\AbstractRepository;
/**
* @method SiteInterface|null find($id, $lockMode = null, $lockVersion = null)
* @method SiteInterface|null findOneBy(array $criteria, array $orderBy = null)
* @method SiteInterface[] findAll()
* @method SiteInterface[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
*/

class SiteRepository extends AbstractRepository class SiteRepository extends AbstractRepository
{ {
public function getInterfaceClass()
public function __construct(ManagerRegistry $registry)
{ {
return SiteInterface::class;
parent::__construct($registry, Site::class);
} }

} }

+ 14
- 0
Repository/Site/SiteRepositoryQuery.php View File

<?php

namespace Lc\SovBundle\Repository\Site;

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

class SiteRepositoryQuery extends AbstractRepositoryQuery implements SiteRepositoryQueryInterface
{
public function __construct(SiteRepository $repository, PaginatorInterface $paginator)
{
parent::__construct($repository, 'r', $paginator);
}
}

+ 8
- 0
Repository/Site/SiteRepositoryQueryInterface.php View File

<?php

namespace Lc\SovBundle\Repository\Site;

interface SiteRepositoryQueryInterface
{

}

+ 13
- 0
Repository/Site/SiteStore.php View File

<?php

namespace Lc\SovBundle\Repository\Site;

class SiteStore implements SiteStoreInterface
{
protected SiteRepositoryQueryInterface $query;

public function __construct(SiteRepositoryQueryInterface $query)
{
$this->query = $query;
}
}

+ 8
- 0
Repository/Site/SiteStoreInterface.php View File

<?php

namespace Lc\SovBundle\Repository\Site;

interface SiteStoreInterface
{

}

+ 4
- 11
Repository/Ticket/TicketMessageRepository.php View File



namespace Lc\SovBundle\Repository\Ticket; namespace Lc\SovBundle\Repository\Ticket;


use Lc\SovBundle\Model\Ticket\TicketMessageInterface;
use App\Entity\Ticket\TicketMessage;
use Doctrine\Persistence\ManagerRegistry;
use Lc\SovBundle\Repository\AbstractRepository; use Lc\SovBundle\Repository\AbstractRepository;


/**
* @method TicketMessageInterface|null find($id, $lockMode = null, $lockVersion = null)
* @method TicketMessageInterface|null findOneBy(array $criteria, array $orderBy = null)
* @method TicketMessageInterface[] findAll()
* @method TicketMessageInterface[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
*/
class TicketMessageRepository extends AbstractRepository class TicketMessageRepository extends AbstractRepository
{ {
public function getInterfaceClass()
public function __construct(ManagerRegistry $registry)
{ {
return TicketMessageInterface::class;
parent::__construct($registry, TicketMessage::class);
} }


} }

+ 14
- 0
Repository/Ticket/TicketMessageRepositoryQuery.php View File

<?php

namespace Lc\SovBundle\Repository\Ticket;

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

class TicketMessageRepositoryQuery extends AbstractRepositoryQuery implements TicketMessageRepositoryQueryInterface
{
public function __construct(TicketMessageRepository $repository, PaginatorInterface $paginator)
{
parent::__construct($repository, 'r', $paginator);
}
}

+ 8
- 0
Repository/Ticket/TicketMessageRepositoryQueryInterface.php View File

<?php

namespace Lc\SovBundle\Repository\Ticket;

interface TicketMessageRepositoryQueryInterface
{

}

+ 13
- 0
Repository/Ticket/TicketMessageStore.php View File

<?php

namespace Lc\SovBundle\Repository\Ticket;

class TicketMessageStore implements TicketMessageStoreInterface
{
protected TicketMessageRepositoryQueryInterface $query;

public function __construct(TicketMessageRepositoryQueryInterface $query)
{
$this->query = $query;
}
}

+ 8
- 0
Repository/Ticket/TicketMessageStoreInterface.php View File

<?php

namespace Lc\SovBundle\Repository\Ticket;

interface TicketMessageStoreInterface
{

}

+ 4
- 11
Repository/Ticket/TicketRepository.php View File



namespace Lc\SovBundle\Repository\Ticket; namespace Lc\SovBundle\Repository\Ticket;


use Lc\SovBundle\Model\Ticket\TicketInterface;
use App\Entity\Ticket\Ticket;
use Doctrine\Persistence\ManagerRegistry;
use Lc\SovBundle\Repository\AbstractRepository; use Lc\SovBundle\Repository\AbstractRepository;


/**
* @method TicketInterface|null find($id, $lockMode = null, $lockVersion = null)
* @method TicketInterface|null findOneBy(array $criteria, array $orderBy = null)
* @method TicketInterface[] findAll()
* @method TicketInterface[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
*/
class TicketRepository extends AbstractRepository class TicketRepository extends AbstractRepository
{ {
public function getInterfaceClass()
public function __construct(ManagerRegistry $registry)
{ {
return TicketInterface::class;
parent::__construct($registry, Ticket::class);
} }


} }

+ 14
- 0
Repository/Ticket/TicketRepositoryQuery.php View File

<?php

namespace Lc\SovBundle\Repository\Ticket;

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

class TicketRepositoryQuery extends AbstractRepositoryQuery implements TicketRepositoryQueryInterface
{
public function __construct(TicketRepository $repository, PaginatorInterface $paginator)
{
parent::__construct($repository, 'r', $paginator);
}
}

+ 8
- 0
Repository/Ticket/TicketRepositoryQueryInterface.php View File

<?php

namespace Lc\SovBundle\Repository\Ticket;

interface TicketRepositoryQueryInterface
{

}

+ 13
- 0
Repository/Ticket/TicketStore.php View File

<?php

namespace Lc\SovBundle\Repository\Ticket;

class TicketStore implements TicketStoreInterface
{
protected TicketRepositoryQueryInterface $query;

public function __construct(TicketRepositoryQueryInterface $query)
{
$this->query = $query;
}
}

+ 8
- 0
Repository/Ticket/TicketStoreInterface.php View File

<?php

namespace Lc\SovBundle\Repository\Ticket;

interface TicketStoreInterface
{

}

+ 4
- 11
Repository/User/GroupUserRepository.php View File



namespace Lc\SovBundle\Repository\User; namespace Lc\SovBundle\Repository\User;


use App\Entity\User\GroupUser;
use Doctrine\Persistence\ManagerRegistry;
use Lc\SovBundle\Repository\AbstractRepository; use Lc\SovBundle\Repository\AbstractRepository;
use Lc\SovBundle\Model\User\GroupUserInterface;


/**
* @method GroupUserInterface|null find($id, $lockMode = null, $lockVersion = null)
* @method GroupUserInterface|null findOneBy(array $criteria, array $orderBy = null)
* @method GroupUserInterface[] findAll()
* @method GroupUserInterface[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
*/
class GroupUserRepository extends AbstractRepository class GroupUserRepository extends AbstractRepository
{ {
public function getInterfaceClass()
public function __construct(ManagerRegistry $registry)
{ {
return GroupUserInterface::class;
parent::__construct($registry, GroupUser::class);
} }


} }

+ 14
- 0
Repository/User/GroupUserRepositoryQuery.php View File

<?php

namespace Lc\SovBundle\Repository\User;

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

class GroupUserRepositoryQuery extends AbstractRepositoryQuery implements GroupUserRepositoryQueryInterface
{
public function __construct(GroupUserRepository $repository, PaginatorInterface $paginator)
{
parent::__construct($repository, 'r', $paginator);
}
}

+ 8
- 0
Repository/User/GroupUserRepositoryQueryInterface.php View File

<?php

namespace Lc\SovBundle\Repository\User;

interface GroupUserRepositoryQueryInterface
{

}

+ 13
- 0
Repository/User/GroupUserStore.php View File

<?php

namespace Lc\SovBundle\Repository\User;

class GroupUserStore implements GroupUserStoreInterface
{
protected GroupUserRepositoryQueryInterface $query;

public function __construct(GroupUserRepositoryQueryInterface $query)
{
$this->query = $query;
}
}

+ 8
- 0
Repository/User/GroupUserStoreInterface.php View File

<?php

namespace Lc\SovBundle\Repository\User;

interface GroupUserStoreInterface
{

}

+ 22
- 57
Repository/User/UserRepository.php View File



namespace Lc\SovBundle\Repository\User; namespace Lc\SovBundle\Repository\User;


use Lc\SovBundle\Model\User\UserInterface;
use App\Entity\User\User;
use Doctrine\Persistence\ManagerRegistry;
use Lc\SovBundle\Repository\AbstractRepository; use Lc\SovBundle\Repository\AbstractRepository;
use Symfony\Component\Security\Core\Exception\UnsupportedUserException; use Symfony\Component\Security\Core\Exception\UnsupportedUserException;
use Symfony\Component\Security\Core\User\PasswordUpgraderInterface;
use Symfony\Component\Security\Core\User\UserInterface as SfUserInterface; use Symfony\Component\Security\Core\User\UserInterface as SfUserInterface;


/**
* @method UserInterface|null find($id, $lockMode = null, $lockVersion = null)
* @method UserInterface|null findOneBy(array $criteria, array $orderBy = null)
* @method UserInterface[] findAll()
* @method UserInterface[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
*/
class UserRepository extends AbstractRepository implements PasswordUpgraderInterface
class UserRepository extends AbstractRepository
{ {
public function getInterfaceClass()
{
return UserInterface::class;
public function __construct(ManagerRegistry $registry)
{
parent::__construct($registry, User::class);
}

/**
* Used to upgrade (rehash) the user's password automatically over time.
*/
public function upgradePassword(SfUserInterface $user, string $newEncodedPassword): void
{
if (!$user instanceof SfUserInterface) {
throw new UnsupportedUserException(sprintf('Instances of "%s" are not supported.', \get_class($user)));
} }


/**
* Used to upgrade (rehash) the user's password automatically over time.
*/
public function upgradePassword(SfUserInterface $user, string $newEncodedPassword): void
{
if (!$user instanceof SfUserInterface) {
throw new UnsupportedUserException(sprintf('Instances of "%s" are not supported.', \get_class($user)));
}
$user->setPassword($newEncodedPassword);
$this->_em->persist($user);
$this->_em->flush();
}


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

public function findByRole($role) {
return $this->createQueryBuilder('u')
public function findByRole($role) {
return $this->createQueryBuilder('u')
->andWhere('u.roles LIKE :role') ->andWhere('u.roles LIKE :role')
->setParameter('role', '%'.$role.'%') ->setParameter('role', '%'.$role.'%')
->getQuery() ->getQuery()
->getResult(); ->getResult();
}

// /**
// * @return User[] Returns an array of User objects
// */
/*
public function findByExampleField($value)
{
return $this->createQueryBuilder('u')
->andWhere('u.exampleField = :val')
->setParameter('val', $value)
->orderBy('u.id', 'ASC')
->setMaxResults(10)
->getQuery()
->getResult()
;
}
*/

/*
public function findOneBySomeField($value): ?User
{
return $this->createQueryBuilder('u')
->andWhere('u.exampleField = :val')
->setParameter('val', $value)
->getQuery()
->getOneOrNullResult()
;
}
*/
}
} }

+ 14
- 0
Repository/User/UserRepositoryQuery.php View File

<?php

namespace Lc\SovBundle\Repository\User;

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

class UserRepositoryQuery extends AbstractRepositoryQuery implements UserRepositoryQueryInterface
{
public function __construct(UserRepository $repository, PaginatorInterface $paginator)
{
parent::__construct($repository, 'r', $paginator);
}
}

+ 8
- 0
Repository/User/UserRepositoryQueryInterface.php View File

<?php

namespace Lc\SovBundle\Repository\User;

interface UserRepositoryQueryInterface
{

}

+ 13
- 0
Repository/User/UserStore.php View File

<?php

namespace Lc\SovBundle\Repository\User;

class UserStore implements UserStoreInterface
{
protected UserRepositoryQueryInterface $query;

public function __construct(UserRepositoryQueryInterface $query)
{
$this->query = $query;
}
}

+ 8
- 0
Repository/User/UserStoreInterface.php View File

<?php

namespace Lc\SovBundle\Repository\User;

interface UserStoreInterface
{

}

Resources/assets/app/adminlte/reminder/app.reminder.js → Resources/assets/app/admin/reminder/app.reminder.js View File


Resources/assets/app/adminlte/reminder/reminder.js → Resources/assets/app/admin/reminder/reminder.js View File

crudAction: $(this).data('crud-action'), crudAction: $(this).data('crud-action'),
crudControllerFqcn: $(this).data('crud-controller-fqcn'), crudControllerFqcn: $(this).data('crud-controller-fqcn'),
entityId: $(this).data('entity-id'), entityId: $(this).data('entity-id'),
id: $(this).data('id'),
}, function(html) { }, function(html) {
$(selectorModal).remove() ; $(selectorModal).remove() ;
$('body').append(html) ; $('body').append(html) ;
}); });
return false ; return false ;
}) ; }) ;

$('.checkbox-reminder').click(function() {
$.post($(this).data('url'), {
id: $(this).data('id'),
done: $(this).is(':checked')
}, function(data) {
Notification.add('success', 'Pense-bête mis à jour');
}, 'json');
}) ;
} }

Resources/assets/app/adminlte/reminder/reminder.scss → Resources/assets/app/admin/reminder/reminder.scss View File

li { li {
div.text { div.text {
padding-left: 30px ; padding-left: 30px ;

.badge-date {
margin-left: 0px;
margin-right: 6px;
}
} }
} }
} }

Resources/assets/app/adminlte/ticket/app.ticket.js → Resources/assets/app/admin/ticket/app.ticket.js View File


Resources/assets/app/adminlte/ticket/ticket.js → Resources/assets/app/admin/ticket/ticket.js View File


+ 3
- 31
Resources/config/routes.yaml View File

type: annotation type: annotation
prefix: /manager prefix: /manager


sov_login:
path: /login
controller: Lc\SovBundle\Controller\Security\SecurityAdminController::login

sov_logout:
path: /logout
controller: Lc\SovBundle\Controller\Security\SecurityAdminController::logout

sov_admin_account_profile:
path: /admin/account/profile
controller: Lc\SovBundle\Controller\User\AccountAdminController::profile

sov_admin_account_password:
path: /admin/account/password
controller: Lc\SovBundle\Controller\User\AccountAdminController::changePassword

sov_admin_setting_global:
path: /admin/setting/global
controller: Lc\SovBundle\Controller\Setting\SettingAdminController::manageGlobal

sov_admin_create_ticket:
path: /admin/ticket/create
controller: Lc\SovBundle\Controller\Ticket\TicketAdminController::create

sov_admin_reminder_render_modal:
path: /admin/reminder/modal
controller: Lc\SovBundle\Controller\Reminder\ReminderAdminController::renderModal

sov_admin_reminder_new:
path: /admin/reminder/new
controller: Lc\SovBundle\Controller\Reminder\ReminderAdminController::new
lc_sov_bundle:
resource: "@LcSovBundle/Controller"
type: annotation

+ 4
- 0
Resources/config/services.yaml View File

arguments: ["@.inner"] arguments: ["@.inner"]
# EasyCorp\Bundle\EasyAdminBundle\Form\Type\CrudFormType: # EasyCorp\Bundle\EasyAdminBundle\Form\Type\CrudFormType:
# class: Lc\SovBundle\Form\Type\CrudFormType # class: Lc\SovBundle\Form\Type\CrudFormType

Lc\SovBundle\Maker\:
resource: '../../Maker/'
tags: [ 'maker.command' ]

+ 17
- 0
Resources/maker/factory/factory.tpl.php View File

<?= "<?php\n" ?>

namespace <?= $namespace_path; ?>\<?= $domain; ?>;

use App\Entity\<?= $domain; ?>\<?= $entity_class ?>;
use Lc\SovBundle\Factory\AbstractFactory;

class <?= $class_name; ?> extends AbstractFactory implements <?= $class_name; ?>Interface
{
public function create(): <?= $entity_class ?>Interface
{
<?= $entity_variable ?> = new <?= $entity_class ?>();

return <?= $entity_variable ?>;
}

}

+ 8
- 0
Resources/maker/factory/factory_interface.tpl.php View File

<?= "<?php\n" ?>

namespace <?= $namespace_path; ?>\<?= $domain; ?>;

interface <?= $interface_name; ?>
{

}

Some files were not shown because too many files changed in this diff

Loading…
Cancel
Save