Browse Source

Essai injection de dépendances

develop
Guillaume 3 years ago
parent
commit
475c01fc6d
17 changed files with 106 additions and 18 deletions
  1. +12
    -0
      Controller/AbstractAdminController.php
  2. +1
    -1
      Controller/Setting/SettingAdminController.php
  3. +2
    -2
      Controller/Ticket/TicketAdminController.php
  4. +16
    -0
      Factory/Site/PageFactory.php
  5. +2
    -2
      Factory/Ticket/TicketFactory.php
  6. +1
    -1
      Factory/Ticket/TicketMessageFactory.php
  7. +8
    -0
      Factory/Ticket/TicketMessageFactoryInterface.php
  8. +1
    -1
      Repository/Reminder/ReminderRepositoryQuery.php
  9. +8
    -0
      Repository/Reminder/ReminderRepositoryQueryInterface.php
  10. +3
    -3
      Repository/Reminder/ReminderStore.php
  11. +8
    -0
      Repository/Reminder/ReminderStoreInterface.php
  12. +14
    -0
      Repository/Ticket/TicketRepositoryQuery.php
  13. +8
    -0
      Repository/Ticket/TicketRepositoryQueryInterface.php
  14. +14
    -0
      Repository/Ticket/TicketStore.php
  15. +8
    -0
      Repository/Ticket/TicketStoreInterface.php
  16. +0
    -7
      Twig/TranslatorTwigExtension.php
  17. +0
    -1
      Twig/TwigExtension.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/Setting/SettingAdminController.php View File

} }


/** /**
* @Route("/admin/setting/site", name="sov_admin_setting_global")
* @Route("/admin/setting/site", name="sov_admin_setting_site")
*/ */
public function manageGlobal(Request $request) public function manageGlobal(Request $request)
{ {

+ 2
- 2
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;


public function __construct( public function __construct(
TicketFactoryInterface $ticketFactory, TicketFactoryInterface $ticketFactory,
TicketMessageFactory $ticketMessageFactory,
TicketMessageFactoryInterface $ticketMessageFactory,
AdminUrlGenerator $adminUrlGenerator AdminUrlGenerator $adminUrlGenerator
) { ) {
$this->ticketFactory = $ticketFactory; $this->ticketFactory = $ticketFactory;

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

<?php

namespace Lc\SovBundle\Factory\Site;

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

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

return $page;
}
}

+ 2
- 2
Factory/Ticket/TicketFactory.php View File



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

+ 1
- 1
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;


class TicketMessageFactory extends AbstractFactory
class TicketMessageFactory extends AbstractFactory implements TicketMessageFactoryInterface
{ {
public function create() public function create()
{ {

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

<?php

namespace Lc\SovBundle\Factory\Ticket;

interface TicketMessageFactoryInterface
{

}

+ 1
- 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(ReminderRepositoryInterface $repository, PaginatorInterface $paginator) public function __construct(ReminderRepositoryInterface $repository, PaginatorInterface $paginator)
{ {

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

<?php

namespace Lc\SovBundle\Repository\Reminder;

interface ReminderRepositoryQueryInterface
{

}

+ 3
- 3
Repository/Reminder/ReminderStore.php View File



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


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

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

<?php

namespace Lc\SovBundle\Repository\Reminder;

interface ReminderStoreInterface
{

}

+ 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(TicketRepositoryInterface $repository, PaginatorInterface $paginator)
{
parent::__construct($repository, 'r', $paginator);
}
}

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

<?php

namespace Lc\SovBundle\Repository\Ticket;

interface TicketRepositoryQueryInterface
{

}

+ 14
- 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
{

}

+ 0
- 7
Twig/TranslatorTwigExtension.php View File



namespace Lc\SovBundle\Twig; namespace Lc\SovBundle\Twig;


use App\Repository\ReminderRepository;
use Doctrine\ORM\EntityManagerInterface;
use Lc\SovBundle\Model\Reminder\ReminderInterface;
use Lc\SovBundle\Repository\Reminder\ReminderStore; use Lc\SovBundle\Repository\Reminder\ReminderStore;
use Lc\SovBundle\Translation\TranslatorAdmin; use Lc\SovBundle\Translation\TranslatorAdmin;
use Liip\ImagineBundle\Imagine\Cache\CacheManager;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface; use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
use Symfony\Component\HttpFoundation\RequestStack; use Symfony\Component\HttpFoundation\RequestStack;
use Symfony\Component\HttpKernel\KernelInterface;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface; use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
use Symfony\Component\Security\Core\Security;
use Symfony\Contracts\Translation\TranslatorInterface;
use Twig\Extension\AbstractExtension; use Twig\Extension\AbstractExtension;
use Twig\TwigFilter; use Twig\TwigFilter;
use Twig\TwigFunction; use Twig\TwigFunction;

+ 0
- 1
Twig/TwigExtension.php View File



use App\Repository\ReminderRepository; use App\Repository\ReminderRepository;
use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\EntityManagerInterface;
use Lc\SovBundle\Model\Reminder\ReminderInterface;
use Lc\SovBundle\Repository\Reminder\ReminderStore; use Lc\SovBundle\Repository\Reminder\ReminderStore;
use Lc\SovBundle\Translation\TranslatorAdmin; use Lc\SovBundle\Translation\TranslatorAdmin;
use Liip\ImagineBundle\Imagine\Cache\CacheManager; use Liip\ImagineBundle\Imagine\Cache\CacheManager;

Loading…
Cancel
Save