Parcourir la source

Système Filtres SovBundle

develop
Fab il y a 3 ans
Parent
révision
00ff2ab5d2
100 fichiers modifiés avec 1207 ajouts et 426 suppressions
  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 Voir le fichier

@@ -376,6 +376,18 @@ abstract class AbstractAdminController extends EaAbstractCrudController
);
}

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
{
$entityManager->update($entityInstance);

+ 1
- 1
Controller/Dashboard/DashboardAdminController.php Voir le fichier

@@ -43,7 +43,7 @@ class DashboardAdminController extends AbstractDashboardController
$assets->addWebpackEncoreEntry('adminlte-sort');
$assets->addWebpackEncoreEntry('adminlte-field-collection');
$assets->addWebpackEncoreEntry('adminlte-field-filemanager');
$assets->addWebpackEncoreEntry('adminlte-reminder');
$assets->addWebpackEncoreEntry('sov-reminder');

return $assets;
}

+ 65
- 47
Controller/Reminder/ReminderAdminController.php Voir le fichier

@@ -7,18 +7,22 @@ use Lc\CaracoleBundle\Resolver\MerchantResolver;
use Lc\CaracoleBundle\Resolver\SectionResolver;
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;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
use Symfony\Component\Routing\Annotation\Route;

class ReminderAdminController extends AbstractController
{

protected EntityManagerInterface $entityManager;
protected ReminderFactoryInterface $reminderFactory;
protected ReminderRepositoryQueryInterface $reminderRepositoryQuery;
protected FormFactoryInterface $formFactory;
protected UrlGeneratorInterface $urlGenerator;
protected MerchantResolver $merchantResolver;
@@ -28,6 +32,7 @@ class ReminderAdminController extends AbstractController
public function __construct(
EntityManagerInterface $entityManager,
ReminderFactoryInterface $reminderFactory,
ReminderRepositoryQueryInterface $reminderRepositoryQuery,
FormFactoryInterface $formFactory,
UrlGeneratorInterface $urlGenerator,
MerchantResolver $merchantResolver,
@@ -36,6 +41,7 @@ class ReminderAdminController extends AbstractController
) {
$this->entityManager = $entityManager;
$this->reminderFactory = $reminderFactory;
$this->reminderRepositoryQuery = $reminderRepositoryQuery;
$this->formFactory = $formFactory;
$this->urlGenerator = $urlGenerator;
$this->merchantResolver = $merchantResolver;
@@ -43,21 +49,35 @@ class ReminderAdminController extends AbstractController
$this->parameterBag = $parameterBag;
}

/**
* @Route("/admin/reminder/modal", name="sov_admin_reminder_render_modal")
*/
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(
ReminderAdminFormType::class,
$reminder,
[
'action' => $this->urlGenerator->generate(
$this->parameterBag->get('app.reminder.route_new')
)
'action' => $action
]
);

@@ -69,6 +89,9 @@ class ReminderAdminController extends AbstractController
);
}

/**
* @Route("/admin/reminder/new", name="sov_admin_reminder_new")
*/
public function new(Request $request)
{
$reminder = $this->createEntity();
@@ -87,56 +110,51 @@ class ReminderAdminController extends AbstractController
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 Voir le fichier

@@ -9,11 +9,13 @@ use Symfony\Component\Security\Http\Authentication\AuthenticationUtils;

class SecurityAdminController extends AbstractController
{

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

// get the login error if there is one
@@ -44,7 +46,7 @@ class SecurityAdminController extends AbstractController
'csrf_token_intention' => 'authenticate',

// 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)
'username_label' => 'Your username',
@@ -63,7 +65,9 @@ class SecurityAdminController extends AbstractController
]);
}


/**
* @Route("/logout", name="sov_logout")
*/
public function logout()
{
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 Voir le fichier

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

use Doctrine\ORM\EntityManagerInterface;
use Lc\CaracoleBundle\Form\Setting\MerchantSettingsFormType;
use Lc\CaracoleBundle\Form\Setting\SectionSettingsFormType;
use Lc\SovBundle\Definition\SiteSettingDefinitionInterface;
use Lc\SovBundle\Form\Setting\SiteSettingsFormType;
use Lc\SovBundle\Repository\Setting\SiteSettingRepository;
@@ -12,6 +10,7 @@ use Lc\SovBundle\Repository\Site\SiteRepository;
use Lc\SovBundle\Translation\TranslatorAdmin;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Routing\Annotation\Route;

class SettingAdminController extends AbstractController
{
@@ -35,6 +34,9 @@ class SettingAdminController extends AbstractController
$this->siteRepository = $siteRepository;
}

/**
* @Route("/admin/setting/site", name="sov_admin_setting_site")
*/
public function manageGlobal(Request $request)
{
$site = $this->siteRepository->findOneByDevAlias('default') ;
@@ -51,7 +53,7 @@ class SettingAdminController extends AbstractController
}

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

+ 6
- 11
Controller/Ticket/TicketAdminController.php Voir le fichier

@@ -14,7 +14,7 @@ use EasyCorp\Bundle\EasyAdminBundle\Field\IntegerField;
use EasyCorp\Bundle\EasyAdminBundle\Field\TextField;
use EasyCorp\Bundle\EasyAdminBundle\Router\AdminUrlGenerator;
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\TicketMessageFormType;
use Lc\SovBundle\Form\Ticket\TicketStatusType;
@@ -54,7 +54,7 @@ class TicketAdminController extends AbstractAdminController
{
$assets = parent::configureAssets($assets);

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

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

)
->setTemplatePath('@LcSov/admin/ticket/index_status.html.twig')
->setTemplatePath('@LcSov/admin/ticket/field/status.html.twig')
->hideOnForm(),
];
}
@@ -118,11 +118,6 @@ class TicketAdminController extends AbstractAdminController
if ($form->isSubmitted() && $form->isValid()) {
$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')->flush();


+ 9
- 2
Controller/User/AccountAdminController.php Voir le fichier

@@ -11,6 +11,7 @@ use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Security\Core\Encoder\UserPasswordEncoderInterface;
use Symfony\Component\Translation\TranslatableMessage;
use Symfony\Component\Routing\Annotation\Route;

class AccountAdminController extends AbstractController
{
@@ -21,6 +22,9 @@ class AccountAdminController extends AbstractController
$this->em = $em;
}

/**
* @Route("/admin/account/profile", name="sov_admin_account_profile")
*/
public function profile(Request $request): Response
{
$user = $this->getUser();
@@ -39,13 +43,16 @@ class AccountAdminController extends AbstractController
}

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

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

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

+ 0
- 10
EventSubscriber/SiteSettingEventSubscriber.php Voir le fichier

@@ -3,15 +3,6 @@
namespace Lc\SovBundle\EventSubscriber;

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\Factory\Setting\SiteSettingFactory;
use Lc\SovBundle\Factory\Site\SiteFactory;
@@ -19,7 +10,6 @@ use Lc\SovBundle\Repository\Setting\SiteSettingRepository;
use Lc\SovBundle\Repository\Site\SiteRepository;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\HttpKernel\KernelEvents;
use Symfony\Component\Security\Core\Security;

class SiteSettingEventSubscriber implements EventSubscriberInterface
{

+ 18
- 0
Factory/File/FileFactory.php Voir le fichier

@@ -0,0 +1,18 @@
<?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 Voir le fichier

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

namespace Lc\SovBundle\Factory\File;

interface FileFactoryInterface
{

}

+ 18
- 0
Factory/Newsletter/NewsletterFactory.php Voir le fichier

@@ -0,0 +1,18 @@
<?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 Voir le fichier

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

namespace Lc\SovBundle\Factory\Newsletter;

interface NewsletterFactoryInterface
{

}

+ 3
- 2
Factory/Setting/SiteSettingFactory.php Voir le fichier

@@ -4,10 +4,11 @@ namespace Lc\SovBundle\Factory\Setting;

use App\Entity\Setting\SiteSetting;
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();


+ 8
- 0
Factory/Setting/SiteSettingFactoryInterface.php Voir le fichier

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

namespace Lc\SovBundle\Factory\Setting;

interface SiteSettingFactoryInterface
{

}

+ 18
- 0
Factory/Site/NewsFactory.php Voir le fichier

@@ -0,0 +1,18 @@
<?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 Voir le fichier

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

namespace Lc\SovBundle\Factory\Site;

interface NewsFactoryInterface
{

}

+ 17
- 0
Factory/Site/PageFactory.php Voir le fichier

@@ -0,0 +1,17 @@
<?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 Voir le fichier

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

namespace Lc\SovBundle\Factory\Site;

interface PageFactoryInterface
{

}

+ 3
- 2
Factory/Site/SiteFactory.php Voir le fichier

@@ -4,10 +4,11 @@ namespace Lc\SovBundle\Factory\Site;

use App\Entity\Site\Site;
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();


+ 8
- 0
Factory/Site/SiteFactoryInterface.php Voir le fichier

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

namespace Lc\SovBundle\Factory\Site;

interface SiteFactoryInterface
{

}

+ 4
- 3
Factory/Ticket/TicketFactory.php Voir le fichier

@@ -4,17 +4,18 @@ namespace Lc\SovBundle\Factory\Ticket;

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

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

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


+ 3
- 2
Factory/Ticket/TicketMessageFactory.php Voir le fichier

@@ -4,10 +4,11 @@ namespace Lc\SovBundle\Factory\Ticket;

use App\Entity\Ticket\TicketMessage;
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();


+ 8
- 0
Factory/Ticket/TicketMessageFactoryInterface.php Voir le fichier

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

namespace Lc\SovBundle\Factory\Ticket;

interface TicketMessageFactoryInterface
{

}

+ 17
- 0
Factory/User/GroupUserFactory.php Voir le fichier

@@ -0,0 +1,17 @@
<?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 Voir le fichier

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

namespace Lc\SovBundle\Factory\User;

interface GroupUserFactoryInterface
{

}

+ 2
- 1
Factory/User/UserFactory.php Voir le fichier

@@ -4,10 +4,11 @@ namespace Lc\SovBundle\Factory\User;

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

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


+ 8
- 0
Factory/User/UserFactoryInterface.php Voir le fichier

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

namespace Lc\SovBundle\Factory\User;

interface UserFactoryInterface
{

}

+ 0
- 8
Form/User/ChangePasswordFormType.php Voir le fichier

@@ -73,14 +73,6 @@ class ChangePasswordFormType extends AbstractType
'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 Voir le fichier

@@ -51,14 +51,6 @@ class ProfileFormType extends AbstractType
TextType::class
);
}

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

/**

+ 108
- 0
Maker/FactoryMaker.php Voir le fichier

@@ -0,0 +1,108 @@
<?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 Voir le fichier

@@ -0,0 +1,125 @@
<?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 Voir le fichier

@@ -19,18 +19,6 @@ abstract class PageModel extends AbstractFullEntity implements PageInterface
*/
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()
{
return $this->getTitle();
@@ -48,28 +36,4 @@ abstract class PageModel extends AbstractFullEntity implements PageInterface
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 Voir le fichier

@@ -2,20 +2,16 @@

namespace Lc\SovBundle\Repository;

use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepositoryInterface;
use Doctrine\ORM\AbstractQuery;
use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\EntityRepository;
use Doctrine\ORM\Query;
use Doctrine\ORM\QueryBuilder;
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;

public function setDefaultLocale($locale)
@@ -23,17 +19,12 @@ abstract class AbstractRepository extends EntityRepository implements ServiceEnt
$this->defaultLocale = $locale;
}

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

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

return $qb->getQuery()->getOneOrNullResult();
}
@@ -43,31 +34,26 @@ abstract class AbstractRepository extends EntityRepository implements ServiceEnt
return $this->getTranslatedQuery($qb, $locale)->getOneOrNullResult($hydrationMode);
}


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


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


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


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


public function getSingleScalarResult(QueryBuilder $qb, $locale = null)
{
return $this->getTranslatedQuery($qb, $locale)->getSingleScalarResult();
@@ -94,15 +80,12 @@ abstract class AbstractRepository extends EntityRepository implements ServiceEnt
$qb = $this->createQueryBuilder('entity')
->select('entity.id, COUNT(entity.slug) as niche')
->andWhere('entity.status>=0')
->andWhere('entity.merchant= :merchant')
->setParameter('merchant', $merchant)
->groupBy('entity.slug')
->having('COUNT(entity.slug) >1');

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


public function findAll()
{
return $this->findBy(array());
@@ -122,9 +105,9 @@ abstract class AbstractRepository extends EntityRepository implements ServiceEnt
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;

if ($entity instanceof StatusInterface) {
@@ -134,9 +117,9 @@ abstract class AbstractRepository extends EntityRepository implements ServiceEnt
if ($criteria['status'] === false) {
unset($criteria['status']);
}
}
}*/

return $criteria;
}


}

+ 0
- 6
Repository/AbstractRepositoryInterface.php Voir le fichier

@@ -6,10 +6,4 @@ namespace Lc\SovBundle\Repository;
interface AbstractRepositoryInterface
{

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

+ 1
- 0
Repository/AbstractRepositoryQuery.php Voir le fichier

@@ -89,5 +89,6 @@ abstract class AbstractRepositoryQuery

return $data;
}

}


+ 7
- 12
Repository/File/FileRepository.php Voir le fichier

@@ -2,19 +2,14 @@

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;
/**
* @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
{
public function getInterfaceClass()
{
return FileInterface::class;
}

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

+ 14
- 0
Repository/File/FileRepositoryQuery.php Voir le fichier

@@ -0,0 +1,14 @@
<?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 Voir le fichier

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

namespace Lc\SovBundle\Repository\File;

interface FileRepositoryQueryInterface
{

}

+ 13
- 0
Repository/File/FileStore.php Voir le fichier

@@ -0,0 +1,13 @@
<?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 Voir le fichier

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

namespace Lc\SovBundle\Repository\File;

interface FileStoreInterface
{

}

+ 4
- 9
Repository/Newsletter/NewsletterRepository.php Voir le fichier

@@ -2,19 +2,14 @@

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;

/**
* @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
{
public function getInterfaceClass()
public function __construct(ManagerRegistry $registry)
{
return NewsletterInterface::class;
parent::__construct($registry, Newsletter::class);
}
}

+ 14
- 0
Repository/Newsletter/NewsletterRepositoryQuery.php Voir le fichier

@@ -0,0 +1,14 @@
<?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 Voir le fichier

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

namespace Lc\SovBundle\Repository\Newsletter;

interface NewsletterRepositoryQueryInterface
{

}

+ 13
- 0
Repository/Newsletter/NewsletterStore.php Voir le fichier

@@ -0,0 +1,13 @@
<?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 Voir le fichier

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

namespace Lc\SovBundle\Repository\Newsletter;

interface NewsletterStoreInterface
{

}

+ 2
- 3
Repository/Reminder/ReminderRepository.php Voir le fichier

@@ -3,11 +3,10 @@
namespace Lc\SovBundle\Repository\Reminder;

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

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

+ 0
- 56
Repository/Reminder/ReminderRepositoryBack.php Voir le fichier

@@ -1,56 +0,0 @@
<?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 Voir le fichier

@@ -5,10 +5,73 @@ namespace Lc\SovBundle\Repository\Reminder;
use Knp\Component\Pager\PaginatorInterface;
use Lc\SovBundle\Repository\AbstractRepositoryQuery;

class ReminderRepositoryQuery extends AbstractRepositoryQuery
class ReminderRepositoryQuery extends AbstractRepositoryQuery implements ReminderRepositoryQueryInterface
{
public function __construct(ReminderRepository $repository, PaginatorInterface $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 Voir le fichier

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

namespace Lc\SovBundle\Repository\Reminder;

interface ReminderRepositoryQueryInterface
{

}

+ 63
- 15
Repository/Reminder/ReminderStore.php Voir le fichier

@@ -2,30 +2,78 @@

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

public function getFoo($query = null)
public function get($params = [], $query = null)
{
if (!$query) {
if(is_null($query)) {
$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 Voir le fichier

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

namespace Lc\SovBundle\Repository\Reminder;

interface ReminderStoreInterface
{

}

+ 4
- 9
Repository/Setting/SiteSettingRepository.php Voir le fichier

@@ -2,19 +2,14 @@

namespace Lc\SovBundle\Repository\Setting;

use App\Entity\Setting\SiteSetting;
use Doctrine\Persistence\ManagerRegistry;
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
{
public function getInterfaceClass()
public function __construct(ManagerRegistry $registry)
{
return SiteSettingInterface::class;
parent::__construct($registry, SiteSetting::class);
}
}

+ 14
- 0
Repository/Setting/SiteSettingRepositoryQuery.php Voir le fichier

@@ -0,0 +1,14 @@
<?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 Voir le fichier

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

namespace Lc\SovBundle\Repository\Setting;

interface SiteSettingRepositoryQueryInterface
{

}

+ 13
- 0
Repository/Setting/SiteSettingStore.php Voir le fichier

@@ -0,0 +1,13 @@
<?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 Voir le fichier

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

namespace Lc\SovBundle\Repository\Setting;

interface SiteSettingStoreInterface
{

}

+ 4
- 9
Repository/Site/NewsRepository.php Voir le fichier

@@ -2,19 +2,14 @@

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;

/**
* @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
{
public function getInterfaceClass()
public function __construct(ManagerRegistry $registry)
{
return NewsInterface::class;
parent::__construct($registry, News::class);
}
}

+ 14
- 0
Repository/Site/NewsRepositoryQuery.php Voir le fichier

@@ -0,0 +1,14 @@
<?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 Voir le fichier

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

namespace Lc\SovBundle\Repository\Site;

interface NewsRepositoryQueryInterface
{

}

+ 13
- 0
Repository/Site/NewsStore.php Voir le fichier

@@ -0,0 +1,13 @@
<?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 Voir le fichier

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

namespace Lc\SovBundle\Repository\Site;

interface NewsStoreInterface
{

}

+ 4
- 9
Repository/Site/PageRepository.php Voir le fichier

@@ -2,19 +2,14 @@

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;

/**
* @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
{
public function getInterfaceClass()
public function __construct(ManagerRegistry $registry)
{
return PageInterface::class;
parent::__construct($registry, Page::class);
}
}

+ 14
- 0
Repository/Site/PageRepositoryQuery.php Voir le fichier

@@ -0,0 +1,14 @@
<?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 Voir le fichier

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

namespace Lc\SovBundle\Repository\Site;

interface PageRepositoryQueryInterface
{

}

+ 13
- 0
Repository/Site/PageStore.php Voir le fichier

@@ -0,0 +1,13 @@
<?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 Voir le fichier

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

namespace Lc\SovBundle\Repository\Site;

interface PageStoreInterface
{

}

+ 5
- 11
Repository/Site/SiteRepository.php Voir le fichier

@@ -2,20 +2,14 @@

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;
/**
* @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
{
public function getInterfaceClass()
public function __construct(ManagerRegistry $registry)
{
return SiteInterface::class;
parent::__construct($registry, Site::class);
}

}

+ 14
- 0
Repository/Site/SiteRepositoryQuery.php Voir le fichier

@@ -0,0 +1,14 @@
<?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 Voir le fichier

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

namespace Lc\SovBundle\Repository\Site;

interface SiteRepositoryQueryInterface
{

}

+ 13
- 0
Repository/Site/SiteStore.php Voir le fichier

@@ -0,0 +1,13 @@
<?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 Voir le fichier

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

namespace Lc\SovBundle\Repository\Site;

interface SiteStoreInterface
{

}

+ 4
- 11
Repository/Ticket/TicketMessageRepository.php Voir le fichier

@@ -2,21 +2,14 @@

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;

/**
* @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
{
public function getInterfaceClass()
public function __construct(ManagerRegistry $registry)
{
return TicketMessageInterface::class;
parent::__construct($registry, TicketMessage::class);
}


}

+ 14
- 0
Repository/Ticket/TicketMessageRepositoryQuery.php Voir le fichier

@@ -0,0 +1,14 @@
<?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 Voir le fichier

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

namespace Lc\SovBundle\Repository\Ticket;

interface TicketMessageRepositoryQueryInterface
{

}

+ 13
- 0
Repository/Ticket/TicketMessageStore.php Voir le fichier

@@ -0,0 +1,13 @@
<?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 Voir le fichier

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

namespace Lc\SovBundle\Repository\Ticket;

interface TicketMessageStoreInterface
{

}

+ 4
- 11
Repository/Ticket/TicketRepository.php Voir le fichier

@@ -2,21 +2,14 @@

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;

/**
* @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
{
public function getInterfaceClass()
public function __construct(ManagerRegistry $registry)
{
return TicketInterface::class;
parent::__construct($registry, Ticket::class);
}


}

+ 14
- 0
Repository/Ticket/TicketRepositoryQuery.php Voir le fichier

@@ -0,0 +1,14 @@
<?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 Voir le fichier

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

namespace Lc\SovBundle\Repository\Ticket;

interface TicketRepositoryQueryInterface
{

}

+ 13
- 0
Repository/Ticket/TicketStore.php Voir le fichier

@@ -0,0 +1,13 @@
<?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 Voir le fichier

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

namespace Lc\SovBundle\Repository\Ticket;

interface TicketStoreInterface
{

}

+ 4
- 11
Repository/User/GroupUserRepository.php Voir le fichier

@@ -2,21 +2,14 @@

namespace Lc\SovBundle\Repository\User;

use App\Entity\User\GroupUser;
use Doctrine\Persistence\ManagerRegistry;
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
{
public function getInterfaceClass()
public function __construct(ManagerRegistry $registry)
{
return GroupUserInterface::class;
parent::__construct($registry, GroupUser::class);
}


}

+ 14
- 0
Repository/User/GroupUserRepositoryQuery.php Voir le fichier

@@ -0,0 +1,14 @@
<?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 Voir le fichier

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

namespace Lc\SovBundle\Repository\User;

interface GroupUserRepositoryQueryInterface
{

}

+ 13
- 0
Repository/User/GroupUserStore.php Voir le fichier

@@ -0,0 +1,13 @@
<?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 Voir le fichier

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

namespace Lc\SovBundle\Repository\User;

interface GroupUserStoreInterface
{

}

+ 22
- 57
Repository/User/UserRepository.php Voir le fichier

@@ -2,73 +2,38 @@

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 Symfony\Component\Security\Core\Exception\UnsupportedUserException;
use Symfony\Component\Security\Core\User\PasswordUpgraderInterface;
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')
->setParameter('role', '%'.$role.'%')
->getQuery()
->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 Voir le fichier

@@ -0,0 +1,14 @@
<?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 Voir le fichier

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

namespace Lc\SovBundle\Repository\User;

interface UserRepositoryQueryInterface
{

}

+ 13
- 0
Repository/User/UserStore.php Voir le fichier

@@ -0,0 +1,13 @@
<?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 Voir le fichier

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

namespace Lc\SovBundle\Repository\User;

interface UserStoreInterface
{

}

Resources/assets/app/adminlte/reminder/app.reminder.js → Resources/assets/app/admin/reminder/app.reminder.js Voir le fichier


Resources/assets/app/adminlte/reminder/reminder.js → Resources/assets/app/admin/reminder/reminder.js Voir le fichier

@@ -11,6 +11,7 @@ function initReminder() {
crudAction: $(this).data('crud-action'),
crudControllerFqcn: $(this).data('crud-controller-fqcn'),
entityId: $(this).data('entity-id'),
id: $(this).data('id'),
}, function(html) {
$(selectorModal).remove() ;
$('body').append(html) ;
@@ -18,4 +19,13 @@ function initReminder() {
});
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 Voir le fichier

@@ -4,6 +4,11 @@ div#reminders {
li {
div.text {
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 Voir le fichier


Resources/assets/app/adminlte/ticket/ticket.js → Resources/assets/app/admin/ticket/ticket.js Voir le fichier


+ 3
- 31
Resources/config/routes.yaml Voir le fichier

@@ -6,34 +6,6 @@ artgris_bundle_file_manager:
type: annotation
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 Voir le fichier

@@ -25,3 +25,7 @@ services:
arguments: ["@.inner"]
# EasyCorp\Bundle\EasyAdminBundle\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 Voir le fichier

@@ -0,0 +1,17 @@
<?= "<?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 Voir le fichier

@@ -0,0 +1,8 @@
<?= "<?php\n" ?>

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

interface <?= $interface_name; ?>
{

}

Certains fichiers n'ont pas été affichés car il y a eu trop de fichiers modifiés dans ce diff

Chargement…
Annuler
Enregistrer