Quellcode durchsuchen

[Technique] Remplacer la notion de "Utils" par "Manager" #1341

feature/souke
Guillaume Bourgeois vor 1 Jahr
Ursprung
Commit
72b3ec20cc
23 geänderte Dateien mit 67 neuen und 89 gelöschten Zeilen
  1. +1
    -1
      backend/controllers/UserController.php
  2. +8
    -0
      common/logic/AbstractManager.php
  3. +1
    -21
      common/logic/AbstractService.php
  4. +0
    -8
      common/logic/AbstractUtils.php
  5. +5
    -6
      common/logic/Document/Document/Module/DocumentModule.php
  6. +2
    -4
      common/logic/Document/Document/Service/DocumentManager.php
  7. +1
    -1
      common/logic/ManagerInterface.php
  8. +5
    -5
      common/logic/Opinion/Module/OpinionModule.php
  9. +2
    -2
      common/logic/Opinion/Service/OpinionManager.php
  10. +4
    -4
      common/logic/Order/Order/Module/OrderModule.php
  11. +11
    -0
      common/logic/Order/Order/Service/OrderManager.php
  12. +0
    -11
      common/logic/Order/Order/Service/OrderUtils.php
  13. +5
    -5
      common/logic/Payment/Module/PaymentModule.php
  14. +2
    -2
      common/logic/Payment/Service/PaymentManager.php
  15. +5
    -5
      common/logic/Producer/Producer/Module/ProducerModule.php
  16. +2
    -2
      common/logic/Producer/Producer/Service/DolibarrProducerUtils.php
  17. +2
    -2
      common/logic/Producer/Producer/Service/ProducerManager.php
  18. +2
    -2
      common/logic/Producer/Producer/Service/ProducerPageSizer.php
  19. +2
    -2
      common/logic/User/User/Service/AuthorizationChecker.php
  20. +2
    -2
      common/logic/User/User/Service/NewsletterManager.php
  21. +2
    -2
      common/logic/User/User/Service/UserNotifier.php
  22. +2
    -1
      frontend/controllers/SiteController.php
  23. +1
    -1
      frontend/views/site/service.php

+ 1
- 1
backend/controllers/UserController.php Datei anzeigen

@@ -401,7 +401,7 @@ class UserController extends BackendController
$creditForm = new CreditForm();
if ($creditForm->load(\Yii::$app->request->post()) && $creditForm->validate()) {

$paymentModule->getUtils()
$paymentModule->getManager()
->creditOrDebitUser(
$creditForm->type,
$user,

+ 8
- 0
common/logic/AbstractManager.php Datei anzeigen

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

namespace common\logic;

abstract class AbstractManager extends AbstractService implements ManagerInterface
{

}

+ 1
- 21
common/logic/AbstractService.php Datei anzeigen

@@ -19,7 +19,7 @@ abstract class AbstractService extends AbstractSingleton implements ServiceInter
NotifierInterface::class,
ResolverInterface::class,
GeneratorInterface::class,
UtilsInterface::class,
ManagerInterface::class,
];
}

@@ -70,26 +70,6 @@ abstract class AbstractService extends AbstractSingleton implements ServiceInter
FactoryInterface, SolverInterface ou BuilderInterface au service.');
}

protected function isSolver(): bool
{
return $this->classImplementsInterface(SolverInterface::class);
}

protected function isBuilder(): bool
{
return $this->classImplementsInterface(BuilderInterface::class);
}

protected function isResolver(): bool
{
return $this->classImplementsInterface(ResolverInterface::class);
}

protected function isUtils(): bool
{
return $this->classImplementsInterface(UtilsInterface::class);
}

protected function classImplementsInterface(string $interface, $object = null)
{
if(is_null($object)) {

+ 0
- 8
common/logic/AbstractUtils.php Datei anzeigen

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

namespace common\logic;

abstract class AbstractUtils extends AbstractService implements UtilsInterface
{

}

+ 5
- 6
common/logic/Document/Document/Module/DocumentModule.php Datei anzeigen

@@ -3,18 +3,17 @@
namespace common\logic\Document\Document\Module;

use common\logic\AbstractModule;
use common\logic\DefinitionInterface;
use common\logic\Document\Document\Repository\DocumentRepository;
use common\logic\Document\Document\Service\DocumentBuilder;
use common\logic\Document\Document\Service\DocumentDefinition;
use common\logic\Document\Document\Service\DocumentSolver;
use common\logic\Document\Document\Service\DocumentUtils;
use common\logic\Document\Document\Service\DocumentManager;

/**
* @mixin DocumentDefinition
* @mixin DocumentSolver
* @mixin DocumentBuilder
* @mixin DocumentUtils
* @mixin DocumentManager
*/
class DocumentModule extends AbstractModule
{
@@ -25,7 +24,7 @@ class DocumentModule extends AbstractModule
DocumentSolver::class,
DocumentRepository::class,
DocumentBuilder::class,
DocumentUtils::class,
DocumentManager::class,
];
}

@@ -49,8 +48,8 @@ class DocumentModule extends AbstractModule
return DocumentBuilder::getInstance();
}

public function getUtils()
public function getManager()
{
return DocumentUtils::getInstance();
return DocumentManager::getInstance();
}
}

common/logic/Document/Document/Service/DocumentUtils.php → common/logic/Document/Document/Service/DocumentManager.php Datei anzeigen

@@ -2,16 +2,14 @@

namespace common\logic\Document\Document\Service;

use common\helpers\GlobalParam;
use common\logic\AbstractService;
use common\logic\AbstractManager;
use common\logic\Document\Document\Model\DocumentInterface;
use common\logic\Producer\Producer\Service\ProducerSolver;
use common\logic\UtilsInterface;
use kartik\mpdf\Pdf;
use yii\base\ErrorException;
use yii\helpers\Html;

class DocumentUtils extends AbstractService implements UtilsInterface
class DocumentManager extends AbstractManager
{
protected DocumentSolver $documentSolver;
protected DocumentBuilder $documentBuilder;

common/logic/UtilsInterface.php → common/logic/ManagerInterface.php Datei anzeigen

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

namespace common\logic;

interface UtilsInterface
interface ManagerInterface
{

}

+ 5
- 5
common/logic/Opinion/Module/OpinionModule.php Datei anzeigen

@@ -3,22 +3,22 @@
namespace common\logic\Opinion\Module;

use common\logic\AbstractModule;
use common\logic\Opinion\Service\OpinionUtils;
use common\logic\Opinion\Service\OpinionManager;

/**
* @mixin OpinionUtils
* @mixin OpinionManager
*/
class OpinionModule extends AbstractModule
{
public function getServices(): array
{
return [
OpinionUtils::class
OpinionManager::class
];
}

public function getUtils(): OpinionUtils
public function getManager(): OpinionManager
{
return OpinionUtils::getInstance();
return OpinionManager::getInstance();
}
}

common/logic/Opinion/Service/OpinionUtils.php → common/logic/Opinion/Service/OpinionManager.php Datei anzeigen

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

namespace common\logic\Opinion\Service;

use common\logic\AbstractUtils;
use common\logic\AbstractManager;
use common\logic\User\User\Model\User;
use common\logic\User\User\Service\UserSolver;

class OpinionUtils extends AbstractUtils
class OpinionManager extends AbstractManager
{
protected UserSolver $userSolver;


+ 4
- 4
common/logic/Order/Order/Module/OrderModule.php Datei anzeigen

@@ -7,7 +7,7 @@ use common\logic\Order\Order\Repository\OrderRepository;
use common\logic\Order\Order\Service\OrderBuilder;
use common\logic\Order\Order\Service\OrderDefinition;
use common\logic\Order\Order\Service\OrderSolver;
use common\logic\Order\Order\Service\OrderUtils;
use common\logic\Order\Order\Service\OrderManager;

/**
* @mixin OrderDefinition
@@ -24,7 +24,7 @@ class OrderModule extends AbstractModule
OrderSolver::class,
OrderRepository::class,
OrderBuilder::class,
OrderUtils::class
OrderManager::class
];
}

@@ -48,8 +48,8 @@ class OrderModule extends AbstractModule
return OrderBuilder::getInstance();
}

public function getUtils(): OrderUtils
public function getUtils(): OrderManager
{
return OrderUtils::getInstance();
return OrderManager::getInstance();
}
}

+ 11
- 0
common/logic/Order/Order/Service/OrderManager.php Datei anzeigen

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

namespace common\logic\Order\Order\Service;

use common\logic\AbstractService;
use common\logic\ManagerInterface;

class OrderManager extends AbstractService implements ManagerInterface
{
}

+ 0
- 11
common/logic/Order/Order/Service/OrderUtils.php Datei anzeigen

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

namespace common\logic\Order\Order\Service;

use common\logic\AbstractService;
use common\logic\UtilsInterface;

class OrderUtils extends AbstractService implements UtilsInterface
{
}

+ 5
- 5
common/logic/Payment/Module/PaymentModule.php Datei anzeigen

@@ -5,7 +5,7 @@ namespace common\logic\Payment\Module;
use common\logic\AbstractModule;
use common\logic\Payment\Repository\PaymentRepository;
use common\logic\Payment\Service\PaymentNotifier;
use common\logic\Payment\Service\PaymentUtils;
use common\logic\Payment\Service\PaymentManager;
use common\logic\Payment\Service\PaymentBuilder;
use common\logic\Payment\Service\PaymentDefinition;
use common\logic\Payment\Service\PaymentSolver;
@@ -15,7 +15,7 @@ use common\logic\Payment\Service\PaymentSolver;
* @mixin PaymentSolver
* @mixin PaymentRepository
* @mixin PaymentBuilder
* @mixin PaymentUtils
* @mixin PaymentManager
*/
class PaymentModule extends AbstractModule
{
@@ -27,7 +27,7 @@ class PaymentModule extends AbstractModule
PaymentBuilder::class,
PaymentRepository::class,
PaymentNotifier::class,
PaymentUtils::class,
PaymentManager::class,
];
}

@@ -56,8 +56,8 @@ class PaymentModule extends AbstractModule
return PaymentNotifier::getInstance();
}

public function getUtils(): PaymentUtils
public function getManager(): PaymentManager
{
return PaymentUtils::getInstance();
return PaymentManager::getInstance();
}
}

common/logic/Payment/Service/PaymentUtils.php → common/logic/Payment/Service/PaymentManager.php Datei anzeigen

@@ -10,10 +10,10 @@ use common\logic\Payment\Model\Payment;
use common\logic\Producer\Producer\Service\ProducerSolver;
use common\logic\User\User\Model\User;
use common\logic\User\User\Repository\UserRepository;
use common\logic\UtilsInterface;
use common\logic\ManagerInterface;
use yii\base\ErrorException;

class PaymentUtils extends AbstractService implements UtilsInterface
class PaymentManager extends AbstractService implements ManagerInterface
{
protected PaymentBuilder $paymentBuilder;
protected OrderSolver $orderSolver;

+ 5
- 5
common/logic/Producer/Producer/Module/ProducerModule.php Datei anzeigen

@@ -9,14 +9,14 @@ use common\logic\Producer\Producer\Service\ProducerBuilder;
use common\logic\Producer\Producer\Service\ProducerDefinition;
use common\logic\Producer\Producer\Service\ProducerPageSizer;
use common\logic\Producer\Producer\Service\ProducerSolver;
use common\logic\Producer\Producer\Service\ProducerUtils;
use common\logic\Producer\Producer\Service\ProducerManager;

/**
* @mixin ProducerDefinition
* @mixin ProducerSolver
* @mixin ProducerRepository
* @mixin ProducerBuilder
* @mixin ProducerUtils
* @mixin ProducerManager
* @mixin ProducerPageSizer
* @mixin DolibarrProducerUtils
*/
@@ -29,7 +29,7 @@ class ProducerModule extends AbstractModule
ProducerSolver::class,
ProducerRepository::class,
ProducerBuilder::class,
ProducerUtils::class,
ProducerManager::class,
ProducerPageSizer::class,
DolibarrProducerUtils::class,
];
@@ -55,9 +55,9 @@ class ProducerModule extends AbstractModule
return ProducerBuilder::getInstance();
}

public function getUtils(): ProducerUtils
public function getUtils(): ProducerManager
{
return ProducerUtils::getInstance();
return ProducerManager::getInstance();
}

public function getProducerPageSizer(): ProducerPageSizer

+ 2
- 2
common/logic/Producer/Producer/Service/DolibarrProducerUtils.php Datei anzeigen

@@ -3,13 +3,13 @@
namespace common\logic\Producer\Producer\Service;

use common\components\DolibarrApi;
use common\logic\AbstractUtils;
use common\logic\AbstractManager;
use common\logic\Producer\Producer\Model\Producer;
use common\logic\Producer\Producer\Repository\ProducerRepository;
use common\logic\Producer\ProducerPriceRange\Repository\ProducerPriceRangeRepository;
use yii\base\ErrorException;

class DolibarrProducerUtils extends AbstractUtils
class DolibarrProducerUtils extends AbstractManager
{
protected DolibarrApi $dolibarrApi;
protected ProducerPriceRangeRepository $producerPriceRangeRepository;

common/logic/Producer/Producer/Service/ProducerUtils.php → common/logic/Producer/Producer/Service/ProducerManager.php Datei anzeigen

@@ -4,9 +4,9 @@ namespace common\logic\Producer\Producer\Service;

use common\logic\AbstractService;
use common\logic\Producer\Producer\Model\Producer;
use common\logic\UtilsInterface;
use common\logic\ManagerInterface;

class ProducerUtils extends AbstractService implements UtilsInterface
class ProducerManager extends AbstractService implements ManagerInterface
{
public function sendEmailNewProducer(Producer $producer): void
{

+ 2
- 2
common/logic/Producer/Producer/Service/ProducerPageSizer.php Datei anzeigen

@@ -3,10 +3,10 @@
namespace common\logic\Producer\Producer\Service;

use common\components\PageSizer;
use common\logic\AbstractUtils;
use common\logic\AbstractManager;
use common\logic\Producer\Producer\Model\Producer;

class ProducerPageSizer extends AbstractUtils
class ProducerPageSizer extends AbstractManager
{
protected ProducerSolver $producerSolver;
protected ProducerBuilder $producerBuilder;

+ 2
- 2
common/logic/User/User/Service/AuthorizationChecker.php Datei anzeigen

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

namespace common\logic\User\User\Service;

use common\logic\AbstractUtils;
use common\logic\AbstractManager;
use common\logic\User\User\Model\User;

class AuthorizationChecker extends AbstractUtils
class AuthorizationChecker extends AbstractManager
{
protected UserSolver $userSolver;


+ 2
- 2
common/logic/User/User/Service/NewsletterManager.php Datei anzeigen

@@ -6,9 +6,9 @@ use common\logic\AbstractService;
use common\logic\User\User\Model\User;
use common\logic\User\UserProducer\Repository\UserProducerRepository;
use common\logic\User\UserProducer\Service\UserProducerBuilder;
use common\logic\UtilsInterface;
use common\logic\ManagerInterface;

class NewsletterManager extends AbstractService implements UtilsInterface
class NewsletterManager extends AbstractService implements ManagerInterface
{
protected UserProducerRepository $userProducerRepository;
protected UserProducerBuilder $userProducerBuilder;

+ 2
- 2
common/logic/User/User/Service/UserNotifier.php Datei anzeigen

@@ -7,9 +7,9 @@ use common\logic\AbstractNotifier;
use common\logic\Producer\Producer\Model\Producer;
use common\logic\Ticket\Ticket\Model\Ticket;
use common\logic\User\User\Model\User;
use common\logic\UtilsInterface;
use common\logic\ManagerInterface;

class UserNotifier extends AbstractNotifier implements UtilsInterface
class UserNotifier extends AbstractNotifier implements ManagerInterface
{
protected UserSolver $userSolver;


+ 2
- 1
frontend/controllers/SiteController.php Datei anzeigen

@@ -504,7 +504,8 @@ class SiteController extends FrontendController
$opinionFormModel = new OpinionForm();
$opinionSent = false;
if ($opinionFormModel->load(Yii::$app->request->post()) && $opinionFormModel->validate()) {
$this->getOpinionModule()->sendOpinionEmailAdmin($opinionFormModel, $this->getUserCurrent());
$this->getOpinionModule()->getManager()
->sendOpinionEmailAdmin($opinionFormModel, $this->getUserCurrent());
$opinionSent = true;
}


+ 1
- 1
frontend/views/site/service.php Datei anzeigen

@@ -57,7 +57,7 @@ $this->setIcon('console');
<?= block_feature("cog", "Une administration complète et intuitive pour gérer votre activité de producteur."); ?>
<div class="clr"></div>
<?= block_feature("calendar", "Planification des jours de distributions."); ?>
<?= block_feature("download-alt", "Accès à un récapitulatif des commandes par jour de distribution."); ?>
<?= block_feature("download-alt", "Récapitulatif des commandes par jour de distribution (PDF et CSV).<br />Génération d'étiquettes (PDF)."); ?>
<?= block_feature("cutlery", "Gestion des produits, catégories et prix spécifiques."); ?>
<?= block_feature("map-marker", "Gestion des points de vente."); ?>
<?= block_feature("repeat", "Gestion des abonnements pour les commandes récurrentes."); ?>

Laden…
Abbrechen
Speichern