Просмотр исходного кода

Refactoring services #885

refactoring
Guillaume Bourgeois 1 год назад
Родитель
Сommit
65594867e5
100 измененных файлов: 603 добавлений и 338 удалений
  1. +1
    -1
      common/components/BusinessLogic.php
  2. +50
    -50
      common/components/BusinessLogicTrait.php
  3. +1
    -1
      common/components/View.php
  4. +2
    -2
      common/controllers/CommonController.php
  5. +2
    -2
      common/logic/AbstractBuilder.php
  6. +8
    -0
      common/logic/AbstractContainer.php
  7. +8
    -2
      common/logic/AbstractManager.php
  8. +8
    -0
      common/logic/AbstractRepository.php
  9. +8
    -0
      common/logic/AbstractRepositoryQuery.php
  10. +6
    -1
      common/logic/AbstractService.php
  11. +36
    -0
      common/logic/AbstractSingleton.php
  12. +2
    -3
      common/logic/Config/TaxRate/TaxRateBuilder.php
  13. +4
    -4
      common/logic/Config/TaxRate/TaxRateContainer.php
  14. +4
    -4
      common/logic/Config/TaxRate/TaxRateManager.php
  15. +9
    -3
      common/logic/Config/TaxRate/TaxRateRepository.php
  16. +10
    -0
      common/logic/Config/TaxRate/TaxRateRepositoryQuery.php
  17. +6
    -6
      common/logic/Distribution/Distribution/DistributionBuilder.php
  18. +5
    -5
      common/logic/Distribution/Distribution/DistributionContainer.php
  19. +4
    -4
      common/logic/Distribution/Distribution/DistributionManager.php
  20. +5
    -4
      common/logic/Distribution/Distribution/DistributionRepository.php
  21. +10
    -0
      common/logic/Distribution/Distribution/DistributionRepositoryQuery.php
  22. +2
    -2
      common/logic/Distribution/Distribution/DistributionSolver.php
  23. +3
    -4
      common/logic/Distribution/PointSaleDistribution/PointSaleDistributionBuilder.php
  24. +4
    -4
      common/logic/Distribution/PointSaleDistribution/PointSaleDistributionContainer.php
  25. +4
    -4
      common/logic/Distribution/PointSaleDistribution/PointSaleDistributionManager.php
  26. +10
    -3
      common/logic/Distribution/PointSaleDistribution/PointSaleDistributionRepository.php
  27. +10
    -0
      common/logic/Distribution/PointSaleDistribution/PointSaleDistributionRepositoryQuery.php
  28. +3
    -3
      common/logic/Distribution/ProductDistribution/ProductDistributionBuilder.php
  29. +4
    -4
      common/logic/Distribution/ProductDistribution/ProductDistributionContainer.php
  30. +4
    -4
      common/logic/Distribution/ProductDistribution/ProductDistributionManager.php
  31. +10
    -4
      common/logic/Distribution/ProductDistribution/ProductDistributionRepository.php
  32. +10
    -0
      common/logic/Distribution/ProductDistribution/ProductDistributionRepositoryQuery.php
  33. +1
    -3
      common/logic/Document/DeliveryNote/DeliveryNoteBuilder.php
  34. +4
    -4
      common/logic/Document/DeliveryNote/DeliveryNoteContainer.php
  35. +2
    -2
      common/logic/Document/DeliveryNote/DeliveryNoteManager.php
  36. +10
    -3
      common/logic/Document/DeliveryNote/DeliveryNoteRepository.php
  37. +10
    -0
      common/logic/Document/DeliveryNote/DeliveryNoteRepositoryQuery.php
  38. +1
    -1
      common/logic/Document/DeliveryNote/DeliveryNoteSearch.php
  39. +0
    -1
      common/logic/Document/DeliveryNote/DeliveryNoteSolver.php
  40. +3
    -7
      common/logic/Document/Document/DocumentBuilder.php
  41. +5
    -5
      common/logic/Document/Document/DocumentContainer.php
  42. +4
    -4
      common/logic/Document/Document/DocumentManager.php
  43. +2
    -2
      common/logic/Document/Document/DocumentSolver.php
  44. +3
    -3
      common/logic/Document/Document/DocumentUtils.php
  45. +1
    -3
      common/logic/Document/Invoice/InvoiceBuilder.php
  46. +5
    -6
      common/logic/Document/Invoice/InvoiceContainer.php
  47. +2
    -2
      common/logic/Document/Invoice/InvoiceManager.php
  48. +10
    -3
      common/logic/Document/Invoice/InvoiceRepository.php
  49. +10
    -0
      common/logic/Document/Invoice/InvoiceRepositoryQuery.php
  50. +4
    -1
      common/logic/Document/Invoice/InvoiceSearch.php
  51. +2
    -3
      common/logic/Document/Quotation/QuotationBuilder.php
  52. +5
    -7
      common/logic/Document/Quotation/QuotationContainer.php
  53. +2
    -2
      common/logic/Document/Quotation/QuotationManager.php
  54. +10
    -3
      common/logic/Document/Quotation/QuotationRepository.php
  55. +10
    -0
      common/logic/Document/Quotation/QuotationRepositoryQuery.php
  56. +36
    -34
      common/logic/Document/Quotation/QuotationSearch.php
  57. +8
    -0
      common/logic/ManagerInterface.php
  58. +4
    -4
      common/logic/Order/Order/OrderBuilder.php
  59. +6
    -6
      common/logic/Order/Order/OrderContainer.php
  60. +4
    -4
      common/logic/Order/Order/OrderManager.php
  61. +6
    -6
      common/logic/Order/Order/OrderRepository.php
  62. +10
    -0
      common/logic/Order/Order/OrderRepositoryQuery.php
  63. +4
    -1
      common/logic/Order/Order/OrderSearch.php
  64. +3
    -3
      common/logic/Order/Order/OrderSolver.php
  65. +2
    -2
      common/logic/Order/Order/OrderUtils.php
  66. +3
    -4
      common/logic/Order/OrderStatusHistory/OrderStatusHistoryBuilder.php
  67. +4
    -4
      common/logic/Order/OrderStatusHistory/OrderStatusHistoryContainer.php
  68. +4
    -4
      common/logic/Order/OrderStatusHistory/OrderStatusHistoryManager.php
  69. +10
    -3
      common/logic/Order/OrderStatusHistory/OrderStatusHistoryRepository.php
  70. +10
    -0
      common/logic/Order/OrderStatusHistory/OrderStatusHistoryRepositoryQuery.php
  71. +4
    -4
      common/logic/Order/ProductOrder/ProductOrderBuilder.php
  72. +5
    -6
      common/logic/Order/ProductOrder/ProductOrderContainer.php
  73. +4
    -4
      common/logic/Order/ProductOrder/ProductOrderManager.php
  74. +10
    -3
      common/logic/Order/ProductOrder/ProductOrderRepository.php
  75. +10
    -0
      common/logic/Order/ProductOrder/ProductOrderRepositoryQuery.php
  76. +2
    -2
      common/logic/Order/ProductOrder/ProductOrderSolver.php
  77. +4
    -4
      common/logic/PointSale/PointSale/PointSaleBuilder.php
  78. +5
    -5
      common/logic/PointSale/PointSale/PointSaleContainer.php
  79. +4
    -4
      common/logic/PointSale/PointSale/PointSaleManager.php
  80. +11
    -2
      common/logic/PointSale/PointSale/PointSaleRepository.php
  81. +10
    -0
      common/logic/PointSale/PointSale/PointSaleRepositoryQuery.php
  82. +3
    -1
      common/logic/PointSale/PointSale/PointSaleSearch.php
  83. +2
    -2
      common/logic/PointSale/PointSale/PointSaleSolver.php
  84. +3
    -3
      common/logic/PointSale/UserPointSale/UserPointSaleBuilder.php
  85. +4
    -5
      common/logic/PointSale/UserPointSale/UserPointSaleContainer.php
  86. +4
    -4
      common/logic/PointSale/UserPointSale/UserPointSaleManager.php
  87. +10
    -3
      common/logic/PointSale/UserPointSale/UserPointSaleRepository.php
  88. +10
    -0
      common/logic/PointSale/UserPointSale/UserPointSaleRepositoryQuery.php
  89. +3
    -3
      common/logic/Producer/Producer/ProducerBuilder.php
  90. +2
    -1
      common/logic/Producer/Producer/ProducerContainer.php
  91. +2
    -2
      common/logic/Producer/Producer/ProducerManager.php
  92. +2
    -2
      common/logic/Producer/Producer/ProducerRepository.php
  93. +2
    -2
      common/logic/Producer/Producer/ProducerSolver.php
  94. +2
    -2
      common/logic/Producer/Producer/ProducerUtils.php
  95. +2
    -2
      common/logic/Producer/ProducerPriceRange/ProducerPriceRangeBuilder.php
  96. +2
    -1
      common/logic/Producer/ProducerPriceRange/ProducerPriceRangeContainer.php
  97. +2
    -2
      common/logic/Producer/ProducerPriceRange/ProducerPriceRangeManager.php
  98. +2
    -2
      common/logic/Producer/ProducerPriceRange/ProducerPriceRangeRepository.php
  99. +2
    -2
      common/logic/Product/Product/ProductBuilder.php
  100. +2
    -1
      common/logic/Product/Product/ProductContainer.php

+ 1
- 1
common/components/BusinessLogic.php Просмотреть файл

@@ -29,7 +29,7 @@ use yii\base\ErrorException;

class BusinessLogic
{
use BusinessLogicContainerTrait;
use BusinessLogicTrait;

public function getContainers()
{

common/components/BusinessLogicContainerTrait.php → common/components/BusinessLogicTrait.php Просмотреть файл

@@ -52,250 +52,250 @@ use common\logic\User\UserProducer\UserProducerManager;
use common\logic\User\UserUserGroup\UserUserGroupContainer;
use common\logic\User\UserUserGroup\UserUserGroupManager;

trait BusinessLogicContainerTrait
trait BusinessLogicTrait
{
public function getUserProducerManager(): UserProducerManager
{
return new UserProducerManager();
return UserProducerManager::getInstance();
}

public function getOrderManager(): OrderManager
{
return new OrderManager();
return OrderManager::getInstance();
}

public function getTaxRateManager(): TaxRateManager
{
return new TaxRateManager();
return TaxRateManager::getInstance();
}

public function getDistributionManager(): DistributionManager
{
return new DistributionManager();
return DistributionManager::getInstance();
}

public function getPointSaleDistributionManager(): PointSaleDistributionManager
{
return new PointSaleDistributionManager();
return PointSaleDistributionManager::getInstance();
}

public function getProductDistributionManager(): ProductDistributionManager
{
return new ProductDistributionManager();
return ProductDistributionManager::getInstance();
}

public function getDeliveryNoteManager(): DeliveryNoteManager
{
return new DeliveryNoteManager();
return DeliveryNoteManager::getInstance();
}

public function getDocumentManager(): DocumentManager
{
return new DocumentManager();
return DocumentManager::getInstance();
}

public function getInvoiceManager(): InvoiceManager
{
return new InvoiceManager();
return InvoiceManager::getInstance();
}

public function getQuotationManager(): QuotationManager
{
return new QuotationManager();
return QuotationManager::getInstance();
}

public function getOrderStatusHistoryManager(): OrderStatusHistoryManager
{
return new OrderStatusHistoryManager();
return OrderStatusHistoryManager::getInstance();
}

public function getProductOrderManager(): ProductOrderManager
{
return new ProductOrderManager();
return ProductOrderManager::getInstance();
}

public function getPointSaleManager(): PointSaleManager
{
return new PointSaleManager();
return PointSaleManager::getInstance();
}

public function getUserPointSaleManager(): UserPointSaleManager
{
return new UserPointSaleManager();
return UserPointSaleManager::getInstance();
}

public function getProducerManager(): ProducerManager
{
return new ProducerManager();
return ProducerManager::getInstance();
}

public function getProducerPriceRangeManager(): ProducerPriceRangeManager
{
return new ProducerPriceRangeManager();
return ProducerPriceRangeManager::getInstance();
}

public function getProductManager(): ProductManager
{
return new ProductManager();
return ProductManager::getInstance();
}

public function getProductCategoryManager(): ProductCategoryManager
{
return new ProductCategoryManager();
return ProductCategoryManager::getInstance();
}

public function getProductPointSaleManager(): ProductPointSaleManager
{
return new ProductPointSaleManager();
return ProductPointSaleManager::getInstance();
}

public function getProductPriceManager(): ProductPriceManager
{
return new ProductPriceManager();
return ProductPriceManager::getInstance();
}

public function getProductSubscriptionManager(): ProductSubscriptionManager
{
return new ProductSubscriptionManager();
return ProductSubscriptionManager::getInstance();
}

public function getSubscriptionManager(): SubscriptionManager
{
return new SubscriptionManager();
return SubscriptionManager::getInstance();
}

public function getCreditHistoryManager(): CreditHistoryManager
{
return new CreditHistoryManager();
return CreditHistoryManager::getInstance();
}

public function getUserManager(): UserManager
{
return new UserManager();
return UserManager::getInstance();
}

public function getUserGroupManager(): UserGroupManager
{
return new UserGroupManager();
return UserGroupManager::getInstance();
}

public function getUserUserGroupManager(): UserUserGroupManager
{
return new UserUserGroupManager();
return UserUserGroupManager::getInstance();
}

public function getUserContainer(): UserContainer
{
return new UserContainer();
return UserContainer::getInstance();
}

public function getProducerContainer(): ProducerContainer
{
return new ProducerContainer();
return ProducerContainer::getInstance();
}

public function getProducerPriceRangeContainer(): ProducerPriceRangeContainer
{
return new ProducerPriceRangeContainer();
return ProducerPriceRangeContainer::getInstance();
}

public function getUserProducerContainer(): UserProducerContainer
{
return new UserProducerContainer();
return UserProducerContainer::getInstance();
}

public function getCreditHistoryContainer(): CreditHistoryContainer
{
return new CreditHistoryContainer();
return CreditHistoryContainer::getInstance();
}

public function getDocumentContainer(): DocumentContainer
{
return new DocumentContainer();
return DocumentContainer::getInstance();
}

public function getUserGroupContainer(): UserGroupContainer
{
return new UserGroupContainer();
return UserGroupContainer::getInstance();
}

public function getUserUserGroupContainer(): UserUserGroupContainer
{
return new UserUserGroupContainer();
return UserUserGroupContainer::getInstance();
}

public function getDistributionContainer(): DistributionContainer
{
return new DistributionContainer();
return DistributionContainer::getInstance();
}

public function getTaxRateContainer(): TaxRateContainer
{
return new TaxRateContainer();
return TaxRateContainer::getInstance();
}

public function getOrderContainer(): OrderContainer
{
return new OrderContainer();
return OrderContainer::getInstance();
}

public function getOrderSatusHistoryContainer(): OrderStatusHistoryContainer
{
return new OrderStatusHistoryContainer();
return OrderStatusHistoryContainer::getInstance();
}

public function getUserPointSaleContainer(): UserPointSaleContainer
{
return new UserPointSaleContainer();
return UserPointSaleContainer::getInstance();
}

public function getPointSaleContainer(): PointSaleContainer
{
return new PointSaleContainer();
return PointSaleContainer::getInstance();
}

public function getProductOrderContainer(): ProductOrderContainer
{
return new ProductOrderContainer();
return ProductOrderContainer::getInstance();
}

public function getProductContainer(): ProductContainer
{
return new ProductContainer();
return ProductContainer::getInstance();
}

public function getProductCategoryContainer(): ProductCategoryContainer
{
return new ProductCategoryContainer();
return ProductCategoryContainer::getInstance();
}

public function getProductPointSaleContainer(): ProductPointSaleContainer
{
return new ProductPointSaleContainer();
return ProductPointSaleContainer::getInstance();
}

public function getProductPriceContainer(): ProductPriceContainer
{
return new ProductPriceContainer();
return ProductPriceContainer::getInstance();
}

public function getSubscriptionContainer(): SubscriptionContainer
{
return new SubscriptionContainer();
return SubscriptionContainer::getInstance();
}

public function getProductSubscriptionContainer(): ProductSubscriptionContainer
{
return new ProductSubscriptionContainer();
return ProductSubscriptionContainer::getInstance();
}

public function getPointSaleDistributionContainer(): PointSaleDistributionContainer
{
return new PointSaleDistributionContainer();
return PointSaleDistributionContainer::getInstance();
}

public function getProductDistributionContainer(): ProductDistributionContainer
{
return new ProductDistributionContainer();
return ProductDistributionContainer::getInstance();
}
}

+ 1
- 1
common/components/View.php Просмотреть файл

@@ -40,7 +40,7 @@ namespace common\components ;

class View extends \yii\web\View
{
use BusinessLogicContainerTrait;
use BusinessLogicTrait;

var $title ;
var $page_title ;

+ 2
- 2
common/controllers/CommonController.php Просмотреть файл

@@ -39,13 +39,13 @@ termes.
namespace common\controllers;

use common\components\BusinessLogic;
use common\components\BusinessLogicContainerTrait;
use common\components\BusinessLogicTrait;
use common\logic\User\User\User;
use yii;

class CommonController extends \yii\web\Controller
{
use BusinessLogicContainerTrait;
use BusinessLogicTrait;

public function beforeAction($event)
{

common/logic/BaseBuilder.php → common/logic/AbstractBuilder.php Просмотреть файл

@@ -4,7 +4,7 @@ namespace common\logic;

use yii\db\ActiveRecord;

class BaseBuilder extends BaseService
abstract class AbstractBuilder extends AbstractService implements BuilderInterface
{
public function saveCreate(ActiveRecord $model): bool
{
@@ -18,6 +18,6 @@ class BaseBuilder extends BaseService

public function delete(ActiveRecord $model): bool
{
$model->delete();
return $model->delete();
}
}

+ 8
- 0
common/logic/AbstractContainer.php Просмотреть файл

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

namespace common\logic;

abstract class AbstractContainer extends AbstractSingleton implements ContainerInterface
{

}

common/logic/BaseManager.php → common/logic/AbstractManager.php Просмотреть файл

@@ -4,7 +4,7 @@ namespace common\logic;

use yii\base\ErrorException;

class BaseManager
abstract class AbstractManager extends AbstractSingleton implements ManagerInterface
{
protected ContainerInterface $container;

@@ -13,7 +13,7 @@ class BaseManager
foreach($this->getContainer()->getServices() as $serviceClass) {
if(method_exists($serviceClass, $method)) {
return call_user_func_array(
[new $serviceClass, $method],
[$serviceClass::getInstance(), $method],
$args
);
}
@@ -31,4 +31,10 @@ class BaseManager
{
return $this->container;
}

public function initContainer(): void
{
$containerFqcn = $this->getContainerFqcn();
$this->setContainer(new $containerFqcn);
}
}

+ 8
- 0
common/logic/AbstractRepository.php Просмотреть файл

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

namespace common\logic;

abstract class AbstractRepository extends AbstractService implements RepositoryInterface
{

}

+ 8
- 0
common/logic/AbstractRepositoryQuery.php Просмотреть файл

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

namespace common\logic;

class AbstractRepositoryQuery extends AbstractService implements RepositoryQueryInterface
{

}

common/logic/BaseService.php → common/logic/AbstractService.php Просмотреть файл

@@ -4,12 +4,13 @@ namespace common\logic;

use yii\base\ErrorException;

class BaseService
abstract class AbstractService extends AbstractSingleton implements ServiceInterface
{
protected function getHierarchy(): array
{
return [
SolverInterface::class,
RepositoryQueryInterface::class,
RepositoryInterface::class,
BuilderInterface::class,
ResolverInterface::class,
@@ -26,6 +27,10 @@ class BaseService
return new $serviceClass;
}

protected function loadDependencies(): void
{
}

protected function respectHierarchy(string $serviceClassAsked): bool
{
$domain = \Yii::$app->logic;

+ 36
- 0
common/logic/AbstractSingleton.php Просмотреть файл

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

namespace common\logic;

abstract class AbstractSingleton
{
private static $instances = array();

final private function __construct()
{
}

final public function __clone()
{
trigger_error("Le clonage n'est pas autorisé.", E_USER_ERROR);
}

final public static function getInstance()
{
$c = get_called_class();

if (!isset(self::$instances[$c])) {
self::$instances[$c] = new $c;

if(in_array(ManagerInterface::class, class_implements(self::$instances[$c]))) {
self::$instances[$c]->initContainer();
}

if(in_array(ServiceInterface::class, class_implements(self::$instances[$c]))) {
self::$instances[$c]->loadDependencies();
}
}

return self::$instances[$c];
}
}

+ 2
- 3
common/logic/Config/TaxRate/TaxRateBuilder.php Просмотреть файл

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

namespace common\logic\Config\TaxRate;

use common\logic\BaseBuilder;
use common\logic\BuilderInterface;
use common\logic\AbstractBuilder;

class TaxRateBuilder extends BaseBuilder implements BuilderInterface
class TaxRateBuilder extends AbstractBuilder
{
public function instanciateTaxRate(): TaxRate
{

+ 4
- 4
common/logic/Config/TaxRate/TaxRateContainer.php Просмотреть файл

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

namespace common\logic\Config\TaxRate;

use common\logic\ContainerInterface;
use common\logic\AbstractContainer;

class TaxRateContainer implements ContainerInterface
class TaxRateContainer extends AbstractContainer
{
public function getEntityFqcn(): string
{
@@ -21,11 +21,11 @@ class TaxRateContainer implements ContainerInterface

public function getBuilder(): TaxRateBuilder
{
return new TaxRateBuilder();
return TaxRateBuilder::getInstance();
}

public function getRepository(): TaxRateRepository
{
return new TaxRateRepository();
return TaxRateRepository::getInstance();
}
}

+ 4
- 4
common/logic/Config/TaxRate/TaxRateManager.php Просмотреть файл

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

namespace common\logic\Config\TaxRate;

use common\logic\BaseManager;
use common\logic\AbstractManager;

/**
* @mixin TaxRateRepository
* @mixin TaxRateBuilder
*/
class TaxRateManager extends BaseManager
class TaxRateManager extends AbstractManager
{
public function __construct()
public function getContainerFqcn(): string
{
$this->setContainer(new TaxRateContainer());
return TaxRateContainer::class;
}
}

+ 9
- 3
common/logic/Config/TaxRate/TaxRateRepository.php Просмотреть файл

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

namespace common\logic\Config\TaxRate;

use common\logic\BaseService;
use common\logic\RepositoryInterface;
use common\logic\AbstractRepository;

class TaxRateRepository extends BaseService implements RepositoryInterface
class TaxRateRepository extends AbstractRepository
{
protected TaxRateRepositoryQuery $query;

public function loadDependencies(): void
{
$this->query = $this->loadService(TaxRateRepositoryQuery::class);
}

public function getDefaultOptionsSearch(): array
{
return [

+ 10
- 0
common/logic/Config/TaxRate/TaxRateRepositoryQuery.php Просмотреть файл

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

namespace common\logic\Config\TaxRate;

use common\logic\AbstractRepositoryQuery;

class TaxRateRepositoryQuery extends AbstractRepositoryQuery
{

}

+ 6
- 6
common/logic/Distribution/Distribution/DistributionBuilder.php Просмотреть файл

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

namespace common\logic\Distribution\Distribution;

use common\logic\BaseBuilder;
use common\logic\AbstractBuilder;
use common\logic\BuilderInterface;
use common\logic\Distribution\PointSaleDistribution\PointSaleDistribution;
use common\logic\Distribution\PointSaleDistribution\PointSaleDistributionBuilder;
@@ -19,7 +19,7 @@ use common\logic\Product\Product\ProductRepository;
use common\logic\User\UserProducer\UserProducerRepository;
use yii\base\Event;

class DistributionBuilder extends BaseBuilder implements BuilderInterface
class DistributionBuilder extends AbstractBuilder
{
protected DistributionRepository $distributionRepository;
protected DistributionSolver $distributionSolver;
@@ -32,7 +32,7 @@ class DistributionBuilder extends BaseBuilder implements BuilderInterface
protected UserProducerRepository $userProducerRepository;
protected ProductOrderBuilder $productOrderBuilder;

public function __construct()
public function loadDependencies(): void
{
$this->distributionRepository = $this->loadService(DistributionRepository::class);
$this->distributionSolver = $this->loadService(DistributionSolver::class);
@@ -77,7 +77,7 @@ class DistributionBuilder extends BaseBuilder implements BuilderInterface

public function createPointSaleDistributions(Distribution $distribution): void
{
$countPointSaleDistribution = $this->pointSaleDistributionRepository->countPointSaleDistributionByDistribution($distribution);
$countPointSaleDistribution = $this->pointSaleDistributionRepository->countPointSaleDistributionsByDistribution($distribution);
if (!$countPointSaleDistribution) {
$this->pointSaleDistributionBuilder->createAllPointSaleDistributions($distribution, true);
}
@@ -86,7 +86,7 @@ class DistributionBuilder extends BaseBuilder implements BuilderInterface
public function createProductDistributions(Distribution $distribution): void
{
$productArray = $this->productRepository->findProducts();
$countProductDistribution = $this->productDistributionRepository->countProductDistributionByDistribution($distribution);
$countProductDistribution = $this->productDistributionRepository->countProductDistributionsByDistribution($distribution);

if (!$countProductDistribution) {
foreach ($productArray as $product) {
@@ -164,7 +164,7 @@ class DistributionBuilder extends BaseBuilder implements BuilderInterface
$userProducer = $this->userProducerRepository->findOneUserProducer($user, $distribution->producer);
}

$this->productOrderBuilder->updatePrice(
$this->productOrderBuilder->updateProductOrderPrice(
$productOrder,
$user,
$userProducer,

+ 5
- 5
common/logic/Distribution/Distribution/DistributionContainer.php Просмотреть файл

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

namespace common\logic\Distribution\Distribution;

use common\logic\ContainerInterface;
use common\logic\AbstractContainer;

class DistributionContainer implements ContainerInterface
class DistributionContainer extends AbstractContainer
{
public function getEntityFqcn(): string
{
@@ -22,16 +22,16 @@ class DistributionContainer implements ContainerInterface

public function getSolver(): DistributionSolver
{
return new DistributionSolver();
return DistributionSolver::getInstance();
}

public function getRepository(): DistributionRepository
{
return new DistributionRepository();
return DistributionRepository::getInstance();
}

public function getBuilder(): DistributionBuilder
{
return new DistributionBuilder();
return DistributionBuilder::getInstance();
}
}

+ 4
- 4
common/logic/Distribution/Distribution/DistributionManager.php Просмотреть файл

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

namespace common\logic\Distribution\Distribution;

use common\logic\BaseManager;
use common\logic\AbstractManager;

/**
* @mixin DistributionSolver
* @mixin DistributionRepository
* @mixin DistributionBuilder
*/
class DistributionManager extends BaseManager
class DistributionManager extends AbstractManager
{
public function __construct()
public function getContainerFqcn(): string
{
$this->setContainer(new DistributionContainer());
return DistributionContainer::class;
}
}

+ 5
- 4
common/logic/Distribution/Distribution/DistributionRepository.php Просмотреть файл

@@ -3,19 +3,20 @@
namespace common\logic\Distribution\Distribution;

use common\helpers\GlobalParam;
use common\logic\BaseService;
use common\logic\AbstractRepository;
use common\logic\Producer\Producer\Producer;
use common\logic\RepositoryInterface;
use common\logic\Subscription\Subscription\Subscription;
use common\logic\Subscription\Subscription\SubscriptionSolver;

class DistributionRepository extends BaseService implements RepositoryInterface
class DistributionRepository extends AbstractRepository
{
protected DistributionRepositoryQuery $query;
protected DistributionSolver $distributionSolver;
protected SubscriptionSolver $subscriptionSolver;

public function __construct()
public function loadDependencies(): void
{
$this->query = $this->loadService(DistributionRepositoryQuery::class);
$this->distributionSolver = $this->loadService(DistributionSolver::class);
$this->subscriptionSolver = $this->loadService(SubscriptionSolver::class);
}

+ 10
- 0
common/logic/Distribution/Distribution/DistributionRepositoryQuery.php Просмотреть файл

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

namespace common\logic\Distribution\Distribution;

use common\logic\AbstractRepositoryQuery;

class DistributionRepositoryQuery extends AbstractRepositoryQuery
{

}

+ 2
- 2
common/logic/Distribution/Distribution/DistributionSolver.php Просмотреть файл

@@ -3,12 +3,12 @@
namespace common\logic\Distribution\Distribution;

use common\helpers\GlobalParam;
use common\logic\BaseService;
use common\logic\AbstractService;
use common\logic\PointSale\PointSale\PointSale;
use common\logic\Product\Product\Product;
use common\logic\SolverInterface;

class DistributionSolver extends BaseService implements SolverInterface
class DistributionSolver extends AbstractService implements SolverInterface
{
public function getDistributionDayAsString(Distribution $distribution): string
{

+ 3
- 4
common/logic/Distribution/PointSaleDistribution/PointSaleDistributionBuilder.php Просмотреть файл

@@ -2,20 +2,19 @@

namespace common\logic\Distribution\PointSaleDistribution;

use common\logic\BaseBuilder;
use common\logic\BuilderInterface;
use common\logic\AbstractBuilder;
use common\logic\Distribution\Distribution\Distribution;
use common\logic\Distribution\Distribution\DistributionRepository;
use common\logic\PointSale\PointSale\PointSale;
use common\logic\PointSale\PointSale\PointSaleRepository;

class PointSaleDistributionBuilder extends BaseBuilder implements BuilderInterface
class PointSaleDistributionBuilder extends AbstractBuilder
{
protected PointSaleDistributionRepository $pointSaleDistributionRepository;
protected PointSaleRepository $pointSaleRepository;
protected DistributionRepository $distributionRepository;

public function __construct()
public function loadDependencies(): void
{
$this->pointSaleDistributionRepository = $this->loadService(PointSaleDistributionRepository::class);
$this->pointSaleRepository = $this->loadService(PointSaleRepository::class);

+ 4
- 4
common/logic/Distribution/PointSaleDistribution/PointSaleDistributionContainer.php Просмотреть файл

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

namespace common\logic\Distribution\PointSaleDistribution;

use common\logic\ContainerInterface;
use common\logic\AbstractContainer;

class PointSaleDistributionContainer implements ContainerInterface
class PointSaleDistributionContainer extends AbstractContainer
{
public function getEntityFqcn(): string
{
@@ -21,11 +21,11 @@ class PointSaleDistributionContainer implements ContainerInterface

public function getRepository(): PointSaleDistributionRepository
{
return new PointSaleDistributionRepository();
return PointSaleDistributionRepository::getInstance();
}

public function getBuilder(): PointSaleDistributionBuilder
{
return new PointSaleDistributionBuilder();
return PointSaleDistributionBuilder::getInstance();
}
}

+ 4
- 4
common/logic/Distribution/PointSaleDistribution/PointSaleDistributionManager.php Просмотреть файл

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

namespace common\logic\Distribution\PointSaleDistribution;

use common\logic\BaseManager;
use common\logic\AbstractManager;

/**
* @mixin PointSaleDistributionRepository
* @mixin PointSaleDistributionBuilder
*/
class PointSaleDistributionManager extends BaseManager
class PointSaleDistributionManager extends AbstractManager
{
public function __construct()
public function getContainerFqcn(): string
{
$this->setContainer(new PointSaleDistributionContainer());
return PointSaleDistributionContainer::class;
}
}

+ 10
- 3
common/logic/Distribution/PointSaleDistribution/PointSaleDistributionRepository.php Просмотреть файл

@@ -2,13 +2,20 @@

namespace common\logic\Distribution\PointSaleDistribution;

use common\logic\BaseService;
use common\logic\AbstractRepository;
use common\logic\Distribution\Distribution\Distribution;
use common\logic\Distribution\Distribution\PointSaleDistributionRepositoryQuery;
use common\logic\PointSale\PointSale\PointSale;
use common\logic\RepositoryInterface;

class PointSaleDistributionRepository extends BaseService implements RepositoryInterface
class PointSaleDistributionRepository extends AbstractRepository
{
protected PointSaleDistributionRepositoryQuery $query;

public function loadDependencies(): void
{
$this->query = $this->loadService(PointSaleDistributionRepositoryQuery::class);
}

public function getDefaultOptionsSearch(): array
{
return [

+ 10
- 0
common/logic/Distribution/PointSaleDistribution/PointSaleDistributionRepositoryQuery.php Просмотреть файл

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

namespace common\logic\Distribution\Distribution;

use common\logic\AbstractRepositoryQuery;

class PointSaleDistributionRepositoryQuery extends AbstractRepositoryQuery
{

}

+ 3
- 3
common/logic/Distribution/ProductDistribution/ProductDistributionBuilder.php Просмотреть файл

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

namespace common\logic\Distribution\ProductDistribution;

use common\logic\BaseBuilder;
use common\logic\AbstractBuilder;
use common\logic\BuilderInterface;
use common\logic\Distribution\Distribution\Distribution;
use common\logic\Distribution\Distribution\DistributionSolver;
use common\logic\Product\Product\Product;
use common\logic\Product\Product\ProductSolver;

class ProductDistributionBuilder extends BaseBuilder implements BuilderInterface
class ProductDistributionBuilder extends AbstractBuilder
{
protected ProductDistributionRepository $productDistributionRepository;
protected DistributionSolver $distributionSolver;
protected ProductSolver $productSolver;

public function __construct()
public function loadDependencies(): void
{
$this->productDistributionRepository = $this->loadService(ProductDistributionRepository::class);
$this->distributionSolver = $this->loadService(DistributionSolver::class);

+ 4
- 4
common/logic/Distribution/ProductDistribution/ProductDistributionContainer.php Просмотреть файл

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

namespace common\logic\Distribution\ProductDistribution;

use common\logic\ContainerInterface;
use common\logic\AbstractContainer;

class ProductDistributionContainer implements ContainerInterface
class ProductDistributionContainer extends AbstractContainer
{
public function getEntityFqcn(): string
{
@@ -21,11 +21,11 @@ class ProductDistributionContainer implements ContainerInterface

public function getRepository(): ProductDistributionRepository
{
return new ProductDistributionRepository();
return ProductDistributionRepository::getInstance();
}

public function getBuilder(): ProductDistributionBuilder
{
return new ProductDistributionBuilder();
return ProductDistributionBuilder::getInstance();
}
}

+ 4
- 4
common/logic/Distribution/ProductDistribution/ProductDistributionManager.php Просмотреть файл

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

namespace common\logic\Distribution\ProductDistribution;

use common\logic\BaseManager;
use common\logic\AbstractManager;

/**
* @mixin ProductDistributionRepository
* @mixin ProductDistributionBuilder
*/
class ProductDistributionManager extends BaseManager
class ProductDistributionManager extends AbstractManager
{
public function __construct()
public function getContainerFqcn(): string
{
$this->setContainer(new ProductDistributionContainer());
return ProductDistributionContainer::class;
}
}

+ 10
- 4
common/logic/Distribution/ProductDistribution/ProductDistributionRepository.php Просмотреть файл

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

namespace common\logic\Distribution\ProductDistribution;

use common\logic\BaseService;
use common\logic\AbstractRepository;
use common\logic\Distribution\Distribution\Distribution;
use common\logic\Order\Order\Order;
use common\logic\Distribution\Distribution\ProductDistributionRepositoryQuery;
use common\logic\Product\Product\Product;
use common\logic\RepositoryInterface;

class ProductDistributionRepository extends BaseService implements RepositoryInterface
class ProductDistributionRepository extends AbstractRepository
{
protected ProductDistributionRepositoryQuery $query;

public function loadDependencies(): void
{
$this->query = $this->loadService(ProductDistributionRepositoryQuery::class);
}

public function getDefaultOptionsSearch(): array
{
return [

+ 10
- 0
common/logic/Distribution/ProductDistribution/ProductDistributionRepositoryQuery.php Просмотреть файл

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

namespace common\logic\Distribution\Distribution;

use common\logic\AbstractRepositoryQuery;

class ProductDistributionRepositoryQuery extends AbstractRepositoryQuery
{

}

+ 1
- 3
common/logic/Document/DeliveryNote/DeliveryNoteBuilder.php Просмотреть файл

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

namespace common\logic\Document\DeliveryNote;

use common\logic\BaseService;
use common\logic\BuilderInterface;
use common\logic\Document\Document\DocumentBuilder;

class DeliveryNoteBuilder extends DocumentBuilder implements BuilderInterface
class DeliveryNoteBuilder extends DocumentBuilder
{
public function instanciateDeliveryNote(): DeliveryNote
{

+ 4
- 4
common/logic/Document/DeliveryNote/DeliveryNoteContainer.php Просмотреть файл

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

namespace common\logic\Document\DeliveryNote;

use common\logic\ContainerInterface;
use common\logic\AbstractContainer;

class DeliveryNoteContainer implements ContainerInterface
class DeliveryNoteContainer extends AbstractContainer
{
public function getEntityFqcn(): string
{
@@ -21,11 +21,11 @@ class DeliveryNoteContainer implements ContainerInterface

public function getFactory(): DeliveryNoteBuilder
{
return new DeliveryNoteBuilder();
return DeliveryNoteBuilder::getInstance();
}

public function getSolver(): DeliveryNoteSolver
{
return new DeliveryNoteSolver();
return DeliveryNoteSolver::getInstance();
}
}

+ 2
- 2
common/logic/Document/DeliveryNote/DeliveryNoteManager.php Просмотреть файл

@@ -12,8 +12,8 @@ use common\logic\PointSale\PointSale\DeliveryNoteRepository;
*/
class DeliveryNoteManager extends DocumentManager
{
public function __construct()
public function getContainerFqcn(): string
{
$this->setContainer(new DeliveryNoteContainer());
return DeliveryNoteContainer::class;
}
}

+ 10
- 3
common/logic/Document/DeliveryNote/DeliveryNoteRepository.php Просмотреть файл

@@ -2,12 +2,19 @@

namespace common\logic\PointSale\PointSale;

use common\logic\BaseService;
use common\logic\AbstractRepository;
use common\logic\Distribution\Distribution\DeliveryNoteRepositoryQuery;
use common\logic\Document\DeliveryNote\DeliveryNote;
use common\logic\RepositoryInterface;

class DeliveryNoteRepository extends BaseService implements RepositoryInterface
class DeliveryNoteRepository extends AbstractRepository
{
protected DeliveryNoteRepositoryQuery $query;

public function loadDependencies(): void
{
$this->query = $this->loadService(DeliveryNoteRepositoryQuery::class);
}

public function getDefaultOptionsSearch(): array
{
return [

+ 10
- 0
common/logic/Document/DeliveryNote/DeliveryNoteRepositoryQuery.php Просмотреть файл

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

namespace common\logic\Distribution\Distribution;

use common\logic\AbstractRepositoryQuery;

class DeliveryNoteRepositoryQuery extends AbstractRepositoryQuery
{

}

+ 1
- 1
common/logic/Document/DeliveryNote/DeliveryNoteSearch.php Просмотреть файл

@@ -59,7 +59,7 @@ class DeliveryNoteSearch extends DeliveryNote

public function search($params)
{
$deliveryNoteRepository = new DeliveryNoteRepository();
$deliveryNoteRepository = DeliveryNoteRepository::getInstance();
$optionsSearch = $deliveryNoteRepository->getDefaultOptionsSearch();

$query = DeliveryNote::find()

+ 0
- 1
common/logic/Document/DeliveryNote/DeliveryNoteSolver.php Просмотреть файл

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

namespace common\logic\Document\DeliveryNote;

use common\logic\BaseService;
use common\logic\Document\Document\DocumentSolver;
use common\logic\Document\Invoice\Invoice;
use common\logic\SolverInterface;

+ 3
- 7
common/logic/Document/Document/DocumentBuilder.php Просмотреть файл

@@ -2,19 +2,15 @@

namespace common\logic\Document\Document;

use common\logic\BaseService;
use common\logic\BuilderInterface;
use common\logic\Producer\Producer\Producer;
use common\logic\AbstractBuilder;
use common\logic\Producer\Producer\ProducerRepository;
use kartik\mpdf\Pdf;
use yii\helpers\Html;

class DocumentBuilder extends BaseService implements BuilderInterface
class DocumentBuilder extends AbstractBuilder
{
protected DocumentSolver $documentSolver;
protected ProducerRepository $producerRepository;

public function __construct()
public function loadDependencies(): void
{
$this->documentSolver = $this->loadService(DocumentSolver::class);
$this->producerRepository = $this->loadService(ProducerRepository::class);

+ 5
- 5
common/logic/Document/Document/DocumentContainer.php Просмотреть файл

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

namespace common\logic\Document\Document;

use common\logic\ContainerInterface;
use common\logic\AbstractContainer;

class DocumentContainer implements ContainerInterface
class DocumentContainer extends AbstractContainer
{
public function getEntityFqcn(): string
{
@@ -22,16 +22,16 @@ class DocumentContainer implements ContainerInterface

public function getSolver(): DocumentSolver
{
return new DocumentSolver();
return DocumentSolver::getInstance();
}

public function getBuilder(): DocumentBuilder
{
return new DocumentBuilder();
return DocumentBuilder::getInstance();
}

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

+ 4
- 4
common/logic/Document/Document/DocumentManager.php Просмотреть файл

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

namespace common\logic\Document\Document;

use common\logic\BaseManager;
use common\logic\AbstractManager;

/**
* @mixin DocumentSolver
* @mixin DocumentBuilder
* @mixin DocumentUtils
*/
class DocumentManager extends BaseManager
class DocumentManager extends AbstractManager
{
public function __construct()
public function getContainerFqcn(): string
{
$this->setContainer(new DocumentContainer());
return DocumentContainer::class;
}
}

+ 2
- 2
common/logic/Document/Document/DocumentSolver.php Просмотреть файл

@@ -3,12 +3,12 @@
namespace common\logic\Document\Document;

use common\helpers\Price;
use common\logic\BaseService;
use common\logic\AbstractService;
use common\logic\Order\Order\Order;
use common\logic\PointSale\PointSale\PointSale;
use common\logic\SolverInterface;

class DocumentSolver extends BaseService implements SolverInterface
class DocumentSolver extends AbstractService implements SolverInterface
{
public function getAmount(DocumentInterface $document, string $type = Order::AMOUNT_TOTAL, bool $format = false)
{

+ 3
- 3
common/logic/Document/Document/DocumentUtils.php Просмотреть файл

@@ -3,7 +3,7 @@
namespace common\logic\Document\Document;

use common\helpers\GlobalParam;
use common\logic\BaseService;
use common\logic\AbstractService;
use common\logic\Producer\Producer\ProducerRepository;
use common\logic\Producer\Producer\ProducerSolver;
use common\logic\UtilsInterface;
@@ -11,14 +11,14 @@ use kartik\mpdf\Pdf;
use yii\base\ErrorException;
use yii\helpers\Html;

class DocumentUtils extends BaseService implements UtilsInterface
class DocumentUtils extends AbstractService implements UtilsInterface
{
protected DocumentSolver $documentSolver;
protected DocumentBuilder $documentBuilder;
protected ProducerSolver $producerSolver;
protected ProducerRepository $producerRepository;

public function __construct()
public function loadDependencies(): void
{
$this->documentSolver = $this->loadService(DocumentSolver::class);
$this->documentBuilder = $this->loadService(DocumentBuilder::class);

+ 1
- 3
common/logic/Document/Invoice/InvoiceBuilder.php Просмотреть файл

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

namespace common\logic\Document\Invoice;

use common\logic\BaseService;
use common\logic\BuilderInterface;
use common\logic\Document\Document\DocumentBuilder;

class InvoiceBuilder extends DocumentBuilder implements BuilderInterface
class InvoiceBuilder extends DocumentBuilder
{
public function instanciateInvoice(): Invoice
{

+ 5
- 6
common/logic/Document/Invoice/InvoiceContainer.php Просмотреть файл

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

namespace common\logic\Document\Invoice;

use common\logic\ContainerInterface;
use common\logic\Document\Document\DocumentBuilder;
use common\logic\AbstractContainer;
use common\logic\Document\Document\DocumentSolver;
use common\logic\PointSale\PointSale\InvoiceRepository;

class InvoiceContainer implements ContainerInterface
class InvoiceContainer extends AbstractContainer
{
public function getEntityFqcn(): string
{
@@ -24,16 +23,16 @@ class InvoiceContainer implements ContainerInterface

public function getSolver(): DocumentSolver
{
return new DocumentSolver();
return DocumentSolver::getInstance();
}

public function getRepository(): InvoiceRepository
{
return new InvoiceRepository();
return InvoiceRepository::getInstance();
}

public function getBuilder(): InvoiceBuilder
{
return new InvoiceBuilder();
return InvoiceBuilder::getInstance();
}
}

+ 2
- 2
common/logic/Document/Invoice/InvoiceManager.php Просмотреть файл

@@ -11,8 +11,8 @@ use common\logic\PointSale\PointSale\InvoiceRepository;
*/
class InvoiceManager extends DocumentManager
{
public function __construct()
public function getContainerFqcn(): string
{
$this->setContainer(new InvoiceContainer());
return InvoiceContainer::class;
}
}

+ 10
- 3
common/logic/Document/Invoice/InvoiceRepository.php Просмотреть файл

@@ -2,12 +2,19 @@

namespace common\logic\PointSale\PointSale;

use common\logic\BaseService;
use common\logic\AbstractRepository;
use common\logic\Distribution\Distribution\InvoiceRepositoryQuery;
use common\logic\Document\Invoice\Invoice;
use common\logic\RepositoryInterface;

class InvoiceRepository extends BaseService implements RepositoryInterface
class InvoiceRepository extends AbstractRepository
{
protected InvoiceRepositoryQuery $query;

public function loadDependencies(): void
{
$this->query = $this->loadService(InvoiceRepositoryQuery::class);
}

public function getDefaultOptionsSearch(): array
{
return [

+ 10
- 0
common/logic/Document/Invoice/InvoiceRepositoryQuery.php Просмотреть файл

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

namespace common\logic\Distribution\Distribution;

use common\logic\AbstractRepositoryQuery;

class InvoiceRepositoryQuery extends AbstractRepositoryQuery
{

}

+ 4
- 1
common/logic/Document/Invoice/InvoiceSearch.php Просмотреть файл

@@ -39,6 +39,8 @@
namespace common\logic\Document\Invoice;

use common\helpers\GlobalParam;
use common\logic\PointSale\PointSale\InvoiceRepository;
use yii\data\ActiveDataProvider;

class InvoiceSearch extends Invoice
{
@@ -55,7 +57,8 @@ class InvoiceSearch extends Invoice

public function search($params)
{
$optionsSearch = self::getDefaultOptionsSearch();
$invoiceRepository = InvoiceRepository::getInstance();
$optionsSearch = $invoiceRepository->getDefaultOptionsSearch();

$query = Invoice::find()
->with($optionsSearch['with'])

+ 2
- 3
common/logic/Document/Quotation/QuotationBuilder.php Просмотреть файл

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

namespace common\logic\Document\Quotation;

use common\logic\BaseService;
use common\logic\BuilderInterface;
use common\logic\AbstractBuilder;

class QuotationBuilder extends BaseService implements BuilderInterface
class QuotationBuilder extends AbstractBuilder
{
public function instanciateQuotation(): Quotation
{

+ 5
- 7
common/logic/Document/Quotation/QuotationContainer.php Просмотреть файл

@@ -2,15 +2,13 @@

namespace common\logic\Document\Invoice;

use common\logic\ContainerInterface;
use common\logic\Document\Document\DocumentBuilder;
use common\logic\AbstractContainer;
use common\logic\Document\Document\DocumentSolver;
use common\logic\Document\Quotation\QuotationBuilder;
use common\logic\Document\Quotation\QuotationFactory;
use common\logic\Document\Quotation\Quotation;
use common\logic\PointSale\PointSale\QuotationRepository;

class QuotationContainer implements ContainerInterface
class QuotationContainer extends AbstractContainer
{
public function getEntityFqcn(): string
{
@@ -26,16 +24,16 @@ class QuotationContainer implements ContainerInterface

public function getSolver(): DocumentSolver
{
return new DocumentSolver();
return DocumentSolver::getInstance();
}
public function getRepository(): QuotationRepository
{
return new QuotationRepository();
return QuotationRepository::getInstance();
}

public function getBuilder(): QuotationBuilder
{
return new QuotationBuilder();
return QuotationBuilder::getInstance();
}
}

+ 2
- 2
common/logic/Document/Quotation/QuotationManager.php Просмотреть файл

@@ -12,8 +12,8 @@ use common\logic\PointSale\PointSale\QuotationRepository;
*/
class QuotationManager extends DocumentManager
{
public function __construct()
public function getContainerFqcn(): string
{
$this->setContainer(new QuotationContainer());
return QuotationContainer::class;
}
}

+ 10
- 3
common/logic/Document/Quotation/QuotationRepository.php Просмотреть файл

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

namespace common\logic\PointSale\PointSale;

use common\logic\BaseService;
use common\logic\RepositoryInterface;
use common\logic\AbstractRepository;
use common\logic\Distribution\Distribution\QuotationRepositoryQuery;

class QuotationRepository extends BaseService implements RepositoryInterface
class QuotationRepository extends AbstractRepository
{
protected QuotationRepositoryQuery $query;

public function loadDependencies(): void
{
$this->query = $this->loadService(QuotationRepositoryQuery::class);
}

public function getDefaultOptionsSearch(): array
{
return [

+ 10
- 0
common/logic/Document/Quotation/QuotationRepositoryQuery.php Просмотреть файл

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

namespace common\logic\Distribution\Distribution;

use common\logic\AbstractRepositoryQuery;

class QuotationRepositoryQuery extends AbstractRepositoryQuery
{

}

+ 36
- 34
common/logic/Document/Quotation/QuotationSearch.php Просмотреть файл

@@ -39,49 +39,51 @@
namespace common\logic\Document\Quotation;

use common\helpers\GlobalParam;
use common\logic\PointSale\PointSale\QuotationRepository;
use yii\data\ActiveDataProvider;

class QuotationSearch extends Quotation
{

public function rules()
{
return [
[[], 'safe'],
[['comment', 'address', 'status'], 'string'],
[['id_user'], 'integer'],
[['name', 'reference'], 'string', 'max' => 255],
];
}
public function rules()
{
return [
[[], 'safe'],
[['comment', 'address', 'status'], 'string'],
[['id_user'], 'integer'],
[['name', 'reference'], 'string', 'max' => 255],
];
}

public function search($params)
{
$optionsSearch = self::getDefaultOptionsSearch();
public function search($params)
{
$quotationRepository = QuotationRepository::getInstance();
$optionsSearch = $quotationRepository->getDefaultOptionsSearch();

$query = Quotation::find()
->with($optionsSearch['with'])
->joinWith($optionsSearch['join_with'])
->where(['quotation.id_producer' => GlobalParam::getCurrentProducerId()])
->orderBy('quotation.status ASC, quotation.reference DESC')
->groupBy('quotation.id');
$query = Quotation::find()
->with($optionsSearch['with'])
->joinWith($optionsSearch['join_with'])
->where(['quotation.id_producer' => GlobalParam::getCurrentProducerId()])
->orderBy('quotation.status ASC, quotation.reference DESC')
->groupBy('quotation.id');

$dataProvider = new ActiveDataProvider([
'query' => $query,
'sort' => ['attributes' => ['name', 'reference', 'date']],
'pagination' => [
'pageSize' => 20,
],
]);
$dataProvider = new ActiveDataProvider([
'query' => $query,
'sort' => ['attributes' => ['name', 'reference', 'date']],
'pagination' => [
'pageSize' => 20,
],
]);

$this->load($params);
if (!$this->validate()) {
return $dataProvider;
}
$this->load($params);
if (!$this->validate()) {
return $dataProvider;
}

$query->andFilterWhere(['like', 'quotation.name', $this->name]);
$query->andFilterWhere(['like', 'quotation.reference', $this->reference]);
$query->andFilterWhere(['like', 'quotation.status', $this->status]);
$query->andFilterWhere(['like', 'quotation.name', $this->name]);
$query->andFilterWhere(['like', 'quotation.reference', $this->reference]);
$query->andFilterWhere(['like', 'quotation.status', $this->status]);

return $dataProvider;
}
return $dataProvider;
}
}

+ 8
- 0
common/logic/ManagerInterface.php Просмотреть файл

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

namespace common\logic;

interface ManagerInterface
{
public function getContainerFqcn(): string;
}

+ 4
- 4
common/logic/Order/Order/OrderBuilder.php Просмотреть файл

@@ -5,8 +5,8 @@ namespace common\logic\Order\Order;
use common\helpers\GlobalParam;
use common\helpers\MeanPayment;
use common\helpers\Price;
use common\logic\BaseBuilder;
use common\logic\BaseService;
use common\logic\AbstractBuilder;
use common\logic\AbstractService;
use common\logic\BuilderInterface;
use common\logic\Config\TaxRate\TaxRate;
use common\logic\Distribution\Distribution\Distribution;
@@ -33,7 +33,7 @@ use common\logic\User\User\UserSolver;
use common\logic\User\UserProducer\UserProducerRepository;
use yii\web\NotFoundHttpException;

class OrderBuilder extends BaseBuilder implements BuilderInterface
class OrderBuilder extends AbstractBuilder
{
protected UserSolver $userSolver;
protected OrderSolver $orderSolver;
@@ -53,7 +53,7 @@ class OrderBuilder extends BaseBuilder implements BuilderInterface
protected SubscriptionRepository $subscriptionRepository;
protected SubscriptionSolver $subscriptionSolver;

public function __construct()
public function loadDependencies(): void
{
$this->userSolver = $this->loadService(UserSolver::class);
$this->orderSolver = $this->loadService(OrderSolver::class);

+ 6
- 6
common/logic/Order/Order/OrderContainer.php Просмотреть файл

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

namespace common\logic\Order\Order;

use common\logic\ContainerInterface;
use common\logic\AbstractContainer;

class OrderContainer implements ContainerInterface
class OrderContainer extends AbstractContainer
{
public function getEntityFqcn(): string
{
@@ -23,21 +23,21 @@ class OrderContainer implements ContainerInterface

public function getSolver(): OrderSolver
{
return new OrderSolver();
return OrderSolver::getInstance();
}

public function getRepository(): OrderRepository
{
return new OrderRepository();
return OrderRepository::getInstance();
}

public function getBuilder(): OrderBuilder
{
return new OrderBuilder();
return OrderBuilder::getInstance();
}

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

+ 4
- 4
common/logic/Order/Order/OrderManager.php Просмотреть файл

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

namespace common\logic\Order\Order;

use common\logic\BaseManager;
use common\logic\AbstractManager;
use common\logic\Config\TaxRate\TaxRate;
use common\logic\Distribution\Distribution\Distribution;
use common\logic\Document\Document\Document;
@@ -18,10 +18,10 @@ use yii\db\Query;
* @mixin OrderRepository
* @mixin OrderBuilder
*/
class OrderManager extends BaseManager
class OrderManager extends AbstractManager
{
public function __construct()
public function getContainerFqcn(): string
{
$this->setContainer(new OrderContainer());
return OrderContainer::class;
}
}

+ 6
- 6
common/logic/Order/Order/OrderRepository.php Просмотреть файл

@@ -2,28 +2,28 @@

namespace common\logic\Order\Order;

use common\logic\BaseService;
use common\logic\AbstractRepository;
use common\logic\Distribution\Distribution\Distribution;
use common\logic\Distribution\ProductDistribution\ProductDistribution;
use common\logic\Distribution\Distribution\OrderRepositoryQuery;
use common\logic\Distribution\ProductDistribution\ProductDistributionRepository;
use common\logic\Order\ProductOrder\ProductOrder;
use common\logic\Order\ProductOrder\ProductOrderRepository;
use common\logic\Producer\Producer\Producer;
use common\logic\Producer\Producer\ProducerRepository;
use common\logic\Product\Product\Product;
use common\logic\RepositoryInterface;
use common\logic\User\User\User;
use yii\helpers\Html;

class OrderRepository extends BaseService implements RepositoryInterface
class OrderRepository extends AbstractRepository
{
protected OrderRepositoryQuery $query;
protected ProductOrderRepository $productOrderRepository;
protected ProducerRepository $producerRepository;
protected OrderSolver $orderSolver;
protected ProductDistributionRepository $productDistributionRepository;

public function __construct()
public function loadDependencies(): void
{
$this->query = $this->loadService(OrderRepositoryQuery::class);
$this->productOrderRepository = $this->loadService(ProductOrderRepository::class);
$this->producerRepository = $this->loadService(ProducerRepository::class);
$this->orderSolver = $this->loadService(OrderSolver::class);

+ 10
- 0
common/logic/Order/Order/OrderRepositoryQuery.php Просмотреть файл

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

namespace common\logic\Distribution\Distribution;

use common\logic\AbstractRepositoryQuery;

class OrderRepositoryQuery extends AbstractRepositoryQuery
{

}

+ 4
- 1
common/logic/Order/Order/OrderSearch.php Просмотреть файл

@@ -38,11 +38,14 @@ termes.

namespace common\logic\Order\Order ;

use yii\data\ActiveDataProvider;

class OrderSearch extends Order
{
public function search($params)
{
$optionsSearch = self::getDefaultOptionsSearch() ;
$orderRepository = OrderRepository::getInstance();
$optionsSearch = $orderRepository->getDefaultOptionsSearch() ;

$paramsSearch = [];
if(isset($params['id_user'])) {

+ 3
- 3
common/logic/Order/Order/OrderSolver.php Просмотреть файл

@@ -4,7 +4,7 @@ namespace common\logic\Order\Order;

use common\helpers\GlobalParam;
use common\helpers\Price;
use common\logic\BaseService;
use common\logic\AbstractService;
use common\logic\Document\Document\Document;
use common\logic\Document\Document\DocumentSolver;
use common\logic\Order\ProductOrder\ProductOrder;
@@ -16,12 +16,12 @@ use common\logic\User\User\UserSolver;
use yii\helpers\Html;


class OrderSolver extends BaseService implements SolverInterface
class OrderSolver extends AbstractService implements SolverInterface
{
protected UserSolver $userSolver;
protected DocumentSolver $documentSolver;

public function __construct()
public function loadDependencies(): void
{
$this->documentSolver = $this->loadService(DocumentSolver::class);
$this->userSolver = $this->loadService(UserSolver::class);

+ 2
- 2
common/logic/Order/Order/OrderUtils.php Просмотреть файл

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

namespace common\logic\Order\Order;

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

class OrderUtils extends BaseService implements UtilsInterface
class OrderUtils extends AbstractService implements UtilsInterface
{
}

+ 3
- 4
common/logic/Order/OrderStatusHistory/OrderStatusHistoryBuilder.php Просмотреть файл

@@ -2,17 +2,16 @@

namespace common\logic\Order\OrderStatusHistory;

use common\logic\BaseBuilder;
use common\logic\BuilderInterface;
use common\logic\AbstractBuilder;
use common\logic\Order\Order\Order;
use common\logic\User\User\User;
use common\logic\User\User\UserSolver;

class OrderStatusHistoryBuilder extends BaseBuilder implements BuilderInterface
class OrderStatusHistoryBuilder extends AbstractBuilder
{
protected UserSolver $userSolver;

public function __construct()
public function loadDependencies(): void
{
$this->userSolver = $this->loadService(UserSolver::class);
}

+ 4
- 4
common/logic/Order/OrderStatusHistory/OrderStatusHistoryContainer.php Просмотреть файл

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

namespace common\logic\Order\OrderStatusHistory;

use common\logic\ContainerInterface;
use common\logic\AbstractContainer;
use common\logic\PointSale\PointSale\OrderStatusHistoryRepository;

class OrderStatusHistoryContainer implements ContainerInterface
class OrderStatusHistoryContainer extends AbstractContainer
{
public function getEntityFqcn(): string
{
@@ -22,11 +22,11 @@ class OrderStatusHistoryContainer implements ContainerInterface

public function getRepository(): OrderStatusHistoryRepository
{
return new OrderStatusHistoryRepository();
return OrderStatusHistoryRepository::getInstance();
}

public function getBuilder(): OrderStatusHistoryBuilder
{
return new OrderStatusHistoryBuilder();
return OrderStatusHistoryBuilder::getInstance();
}
}

+ 4
- 4
common/logic/Order/OrderStatusHistory/OrderStatusHistoryManager.php Просмотреть файл

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

namespace common\logic\Order\OrderStatusHistory;

use common\logic\BaseManager;
use common\logic\AbstractManager;
use common\logic\PointSale\PointSale\OrderStatusHistoryRepository;

/**
* @mixin OrderStatusHistoryRepository
* @mixin OrderStatusHistoryBuilder
*/
class OrderStatusHistoryManager extends BaseManager
class OrderStatusHistoryManager extends AbstractManager
{
public function __construct()
public function getContainerFqcn(): string
{
$this->setContainer(new OrderStatusHistoryContainer());
return OrderStatusHistoryContainer::class;
}
}

+ 10
- 3
common/logic/Order/OrderStatusHistory/OrderStatusHistoryRepository.php Просмотреть файл

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

namespace common\logic\PointSale\PointSale;

use common\logic\BaseService;
use common\logic\RepositoryInterface;
use common\logic\AbstractRepository;
use common\logic\Distribution\Distribution\OrderStatusHistoryRepositoryQuery;

class OrderStatusHistoryRepository extends BaseService implements RepositoryInterface
class OrderStatusHistoryRepository extends AbstractRepository
{
protected OrderStatusHistoryRepositoryQuery $query;

public function loadDependencies(): void
{
$this->query = $this->loadService(OrderStatusHistoryRepositoryQuery::class);
}

public function getDefaultOptionsSearch(): array
{
return [

+ 10
- 0
common/logic/Order/OrderStatusHistory/OrderStatusHistoryRepositoryQuery.php Просмотреть файл

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

namespace common\logic\Distribution\Distribution;

use common\logic\AbstractRepositoryQuery;

class OrderStatusHistoryRepositoryQuery extends AbstractRepositoryQuery
{

}

+ 4
- 4
common/logic/Order/ProductOrder/ProductOrderBuilder.php Просмотреть файл

@@ -2,8 +2,8 @@

namespace common\logic\Order\ProductOrder;

use common\logic\BaseBuilder;
use common\logic\BaseService;
use common\logic\AbstractBuilder;
use common\logic\AbstractService;
use common\logic\BuilderInterface;
use common\logic\Config\TaxRate\TaxRate;
use common\logic\Order\Order\Order;
@@ -13,11 +13,11 @@ use common\logic\Product\Product\ProductSolver;
use common\logic\User\User\User;
use common\logic\User\UserProducer\UserProducer;

class ProductOrderBuilder extends BaseBuilder implements BuilderInterface
class ProductOrderBuilder extends AbstractBuilder
{
protected ProductSolver $productSolver;

public function __construct()
public function loadDependencies(): void
{
$this->productSolver = $this->loadService(ProductSolver::class);
}

+ 5
- 6
common/logic/Order/ProductOrder/ProductOrderContainer.php Просмотреть файл

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

namespace common\logic\Order\ProductOrder;

use common\logic\ContainerInterface;
use common\logic\Order\ProductOrder\ProductOrderRepository;
use common\logic\AbstractContainer;

class ProductOrderContainer implements ContainerInterface
class ProductOrderContainer extends AbstractContainer
{
public function getEntityFqcn(): string
{
@@ -23,16 +22,16 @@ class ProductOrderContainer implements ContainerInterface

public function getSolver(): ProductOrderSolver
{
return new ProductOrderSolver();
return ProductOrderSolver::getInstance();
}

public function getRepository(): ProductOrderRepository
{
return new ProductOrderRepository();
return ProductOrderRepository::getInstance();
}

public function getBuilder(): ProductOrderBuilder
{
return new ProductOrderBuilder();
return ProductOrderBuilder::getInstance();
}
}

+ 4
- 4
common/logic/Order/ProductOrder/ProductOrderManager.php Просмотреть файл

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

namespace common\logic\Order\ProductOrder;

use common\logic\BaseManager;
use common\logic\AbstractManager;

/**
* @mixin ProductOrderSolver
* @mixin ProductOrderRepository
* @mixin ProductOrderBuilder
*/
class ProductOrderManager extends BaseManager
class ProductOrderManager extends AbstractManager
{
public function __construct()
public function getContainerFqcn(): string
{
$this->setContainer(new ProductOrderContainer());
return ProductOrderContainer::class;
}
}

+ 10
- 3
common/logic/Order/ProductOrder/ProductOrderRepository.php Просмотреть файл

@@ -2,12 +2,19 @@

namespace common\logic\Order\ProductOrder;

use common\logic\BaseService;
use common\logic\AbstractRepository;
use common\logic\Distribution\Distribution\ProductOrderRepositoryQuery;
use common\logic\Order\Order\Order;
use common\logic\RepositoryInterface;

class ProductOrderRepository extends BaseService implements RepositoryInterface
class ProductOrderRepository extends AbstractRepository
{
protected ProductOrderRepositoryQuery $query;

public function loadDependencies(): void
{
$this->query = $this->loadService(ProductOrderRepositoryQuery::class);
}

public function getDefaultOptionsSearch(): array
{
return [

+ 10
- 0
common/logic/Order/ProductOrder/ProductOrderRepositoryQuery.php Просмотреть файл

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

namespace common\logic\Distribution\Distribution;

use common\logic\AbstractRepositoryQuery;

class ProductOrderRepositoryQuery extends AbstractRepositoryQuery
{

}

+ 2
- 2
common/logic/Order/ProductOrder/ProductOrderSolver.php Просмотреть файл

@@ -3,11 +3,11 @@
namespace common\logic\Order\ProductOrder;

use common\helpers\Price;
use common\logic\BaseService;
use common\logic\AbstractService;
use common\logic\Order\Order\Order;
use common\logic\SolverInterface;

class ProductOrderSolver extends BaseService implements SolverInterface
class ProductOrderSolver extends AbstractService implements SolverInterface
{
/**
* Retourne le prix du produit avec taxe

+ 4
- 4
common/logic/PointSale/PointSale/PointSaleBuilder.php Просмотреть файл

@@ -2,8 +2,8 @@

namespace common\logic\PointSale\PointSale;

use common\logic\BaseBuilder;
use common\logic\BaseService;
use common\logic\AbstractBuilder;
use common\logic\AbstractService;
use common\logic\BuilderInterface;
use common\logic\PointSale\UserPointSale\UserPointSale;
use common\logic\PointSale\UserPointSale\UserPointSaleBuilder;
@@ -12,13 +12,13 @@ use common\logic\Producer\Producer\Producer;
use common\logic\User\User\User;
use common\logic\User\User\UserRepository;

class PointSaleBuilder extends BaseBuilder implements BuilderInterface
class PointSaleBuilder extends AbstractBuilder
{
protected UserPointSaleBuilder $userPointSaleBuilder;
protected UserRepository $userRepository;
protected UserPointSaleRepository $userPointSaleRepository;

public function __construct()
public function loadDependencies(): void
{
$this->userPointSaleBuilder = $this->loadService(UserPointSaleBuilder::class);
$this->userRepository = $this->loadService(UserRepository::class);

+ 5
- 5
common/logic/PointSale/PointSale/PointSaleContainer.php Просмотреть файл

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

namespace common\logic\PointSale\PointSale;

use common\logic\ContainerInterface;
use common\logic\AbstractContainer;

class PointSaleContainer implements ContainerInterface
class PointSaleContainer extends AbstractContainer
{
public function getEntityFqcn(): string
{
@@ -22,16 +22,16 @@ class PointSaleContainer implements ContainerInterface

public function getSolver(): PointSaleSolver
{
return new PointSaleSolver();
return PointSaleSolver::getInstance();
}

public function getRepository(): PointSaleRepository
{
return new PointSaleRepository();
return PointSaleRepository::getInstance();
}

public function getBuilder(): PointSaleBuilder
{
return new PointSaleBuilder();
return PointSaleBuilder::getInstance();
}
}

+ 4
- 4
common/logic/PointSale/PointSale/PointSaleManager.php Просмотреть файл

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

namespace common\logic\PointSale\PointSale;

use common\logic\BaseManager;
use common\logic\AbstractManager;

/**
* @mixin PointSaleSolver
* @mixin PointSaleRepository
* @mixin PointSaleBuilder
*/
class PointSaleManager extends BaseManager
class PointSaleManager extends AbstractManager
{
public function __construct()
public function getContainerFqcn(): string
{
$this->setContainer(new PointSaleContainer());
return PointSaleContainer::class;
}
}

+ 11
- 2
common/logic/PointSale/PointSale/PointSaleRepository.php Просмотреть файл

@@ -3,14 +3,23 @@
namespace common\logic\PointSale\PointSale;

use common\helpers\GlobalParam;
use common\logic\BaseService;
use common\logic\AbstractRepository;
use common\logic\AbstractService;
use common\logic\BuilderInterface;
use common\logic\Distribution\Distribution\Distribution;
use common\logic\Distribution\Distribution\PointSaleRepositoryQuery;
use common\logic\Producer\Producer\Producer;
use common\logic\RepositoryInterface;

class PointSaleRepository extends BaseService implements RepositoryInterface
class PointSaleRepository extends AbstractRepository
{
protected PointSaleRepositoryQuery $query;

public function loadDependencies(): void
{
$this->query = $this->loadService(PointSaleRepositoryQuery::class);
}

public function getDefaultOptionsSearch(): array
{
return [

+ 10
- 0
common/logic/PointSale/PointSale/PointSaleRepositoryQuery.php Просмотреть файл

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

namespace common\logic\Distribution\Distribution;

use common\logic\AbstractRepositoryQuery;

class PointSaleRepositoryQuery extends AbstractRepositoryQuery
{

}

+ 3
- 1
common/logic/PointSale/PointSale/PointSaleSearch.php Просмотреть файл

@@ -39,6 +39,7 @@ termes.
namespace common\logic\PointSale\PointSale ;

use common\helpers\GlobalParam;
use yii\data\ActiveDataProvider;

class PointSaleSearch extends PointSale
{
@@ -63,7 +64,8 @@ class PointSaleSearch extends PointSale
public function search($params)
{
$optionsSearch = self::getDefaultOptionsSearch() ;
$pointSaleRepository = PointSaleRepository::getInstance();
$optionsSearch = $pointSaleRepository->getDefaultOptionsSearch() ;
$query = PointSale::find()
->with($optionsSearch['with'])

+ 2
- 2
common/logic/PointSale/PointSale/PointSaleSolver.php Просмотреть файл

@@ -3,11 +3,11 @@
namespace common\logic\PointSale\PointSale;

use common\helpers\GlobalParam;
use common\logic\BaseService;
use common\logic\AbstractService;
use common\logic\SolverInterface;
use yii\helpers\Html;

class PointSaleSolver extends BaseService implements SolverInterface
class PointSaleSolver extends AbstractService implements SolverInterface
{
/**
* Retourne le commentaire de l'utilisateur courant lié au point de vente.

+ 3
- 3
common/logic/PointSale/UserPointSale/UserPointSaleBuilder.php Просмотреть файл

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

namespace common\logic\PointSale\UserPointSale;

use common\logic\BaseBuilder;
use common\logic\AbstractBuilder;
use common\logic\BuilderInterface;
use common\logic\PointSale\PointSale\PointSale;
use common\logic\User\User\User;

class UserPointSaleBuilder extends BaseBuilder implements BuilderInterface
class UserPointSaleBuilder extends AbstractBuilder
{
protected UserPointSaleRepository $userPointSaleRepository;

public function __construct()
public function loadDependencies(): void
{
$this->userPointSaleRepository = $this->loadService(UserPointSaleRepository::class);
}

+ 4
- 5
common/logic/PointSale/UserPointSale/UserPointSaleContainer.php Просмотреть файл

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

namespace common\logic\PointSale\UserPointSale;

use common\logic\ContainerInterface;
use common\logic\PointSale\UserPointSale\UserPointSaleRepository;
use common\logic\AbstractContainer;

class UserPointSaleContainer implements ContainerInterface
class UserPointSaleContainer extends AbstractContainer
{
public function getEntityFqcn(): string
{
@@ -22,11 +21,11 @@ class UserPointSaleContainer implements ContainerInterface

public function getRepository(): UserPointSaleRepository
{
return new UserPointSaleRepository();
return UserPointSaleRepository::getInstance();
}

public function getBuilder(): UserPointSaleBuilder
{
return new UserPointSaleBuilder();
return UserPointSaleBuilder::getInstance();
}
}

+ 4
- 4
common/logic/PointSale/UserPointSale/UserPointSaleManager.php Просмотреть файл

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

namespace common\logic\PointSale\UserPointSale;

use common\logic\BaseManager;
use common\logic\AbstractManager;

/**
* @mixin UserPointSaleRepository
* @mixin UserPointSaleBuilder
*/
class UserPointSaleManager extends BaseManager
class UserPointSaleManager extends AbstractManager
{
public function __construct()
public function getContainerFqcn(): string
{
$this->setContainer(new UserPointSaleContainer());
return UserPointSaleContainer::class;
}
}

+ 10
- 3
common/logic/PointSale/UserPointSale/UserPointSaleRepository.php Просмотреть файл

@@ -2,13 +2,20 @@

namespace common\logic\PointSale\UserPointSale;

use common\logic\BaseService;
use common\logic\AbstractRepository;
use common\logic\Distribution\Distribution\UserPointSaleRepositoryQuery;
use common\logic\PointSale\PointSale\PointSale;
use common\logic\RepositoryInterface;
use common\logic\User\User\User;

class UserPointSaleRepository extends BaseService implements RepositoryInterface
class UserPointSaleRepository extends AbstractRepository
{
protected UserPointSaleRepositoryQuery $query;

public function loadDependencies(): void
{
$this->query = $this->loadService(UserPointSaleRepositoryQuery::class);
}

public function getDefaultOptionsSearch(): array
{
return [

+ 10
- 0
common/logic/PointSale/UserPointSale/UserPointSaleRepositoryQuery.php Просмотреть файл

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

namespace common\logic\Distribution\Distribution;

use common\logic\AbstractRepositoryQuery;

class UserPointSaleRepositoryQuery extends AbstractRepositoryQuery
{

}

+ 3
- 3
common/logic/Producer/Producer/ProducerBuilder.php Просмотреть файл

@@ -4,8 +4,8 @@ namespace common\logic\Producer\Producer;

use common\helpers\Opendistrib;
use common\helpers\Password;
use common\logic\BaseBuilder;
use common\logic\BaseService;
use common\logic\AbstractBuilder;
use common\logic\AbstractService;
use common\logic\BuilderInterface;
use common\logic\User\User\User;
use common\logic\User\UserProducer\UserProducer;
@@ -13,7 +13,7 @@ use common\logic\User\UserProducer\UserProducerBuilder;
use common\logic\User\UserProducer\UserProducerRepository;
use common\helpers\Url;

class ProducerBuilder extends BaseBuilder implements BuilderInterface
class ProducerBuilder extends AbstractBuilder implements BuilderInterface
{
protected ProducerRepository $producerRepository;
protected UserProducerRepository $userProducerRepository;

+ 2
- 1
common/logic/Producer/Producer/ProducerContainer.php Просмотреть файл

@@ -3,8 +3,9 @@
namespace common\logic\Producer\Producer;

use common\logic\ContainerInterface;
use common\logic\AbstractSingleton;

class ProducerContainer implements ContainerInterface
class ProducerContainer extends AbstractSingleton implements ContainerInterface
{
public function getEntityFqcn(): string
{

+ 2
- 2
common/logic/Producer/Producer/ProducerManager.php Просмотреть файл

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

namespace common\logic\Producer\Producer;

use common\logic\BaseManager;
use common\logic\AbstractManager;

/**
* @mixin ProducerSolver
@@ -10,7 +10,7 @@ use common\logic\BaseManager;
* @mixin ProducerBuilder
* @mixin ProducerUtils
*/
class ProducerManager extends BaseManager
class ProducerManager extends AbstractManager
{
public function __construct()
{

+ 2
- 2
common/logic/Producer/Producer/ProducerRepository.php Просмотреть файл

@@ -5,7 +5,7 @@ namespace common\logic\Producer\Producer;
use common\helpers\Departments;
use common\helpers\GlobalParam;
use common\helpers\Price;
use common\logic\BaseService;
use common\logic\AbstractService;
use common\logic\Document\Document\DocumentInterface;
use common\logic\Document\Document\DocumentSolver;
use common\logic\PointSale\PointSale\PointSale;
@@ -15,7 +15,7 @@ use common\logic\RepositoryInterface;
use common\logic\User\User\User;
use yii\helpers\Html;

class ProducerRepository extends BaseService implements RepositoryInterface
class ProducerRepository extends AbstractService implements RepositoryInterface
{
protected ProducerPriceRangeRepository $producerPriceRangeRepository;
protected ProducerSolver $producerSolver;

+ 2
- 2
common/logic/Producer/Producer/ProducerSolver.php Просмотреть файл

@@ -3,11 +3,11 @@
namespace common\logic\Producer\Producer;

use common\helpers\GlobalParam;
use common\logic\BaseService;
use common\logic\AbstractService;
use common\logic\SolverInterface;
use common\logic\User\User\User;

class ProducerSolver extends BaseService implements SolverInterface
class ProducerSolver extends AbstractService implements SolverInterface
{

/**

+ 2
- 2
common/logic/Producer/Producer/ProducerUtils.php Просмотреть файл

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

namespace common\logic\Producer\Producer;

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

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

+ 2
- 2
common/logic/Producer/ProducerPriceRange/ProducerPriceRangeBuilder.php Просмотреть файл

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

namespace common\logic\Producer\ProducerPriceRange;

use common\logic\BaseBuilder;
use common\logic\AbstractBuilder;

class ProducerPriceRangeBuilder extends BaseBuilder
class ProducerPriceRangeBuilder extends AbstractBuilder
{
public function instanciateProducerPriceRange(): ProducerPriceRange
{

+ 2
- 1
common/logic/Producer/ProducerPriceRange/ProducerPriceRangeContainer.php Просмотреть файл

@@ -3,8 +3,9 @@
namespace common\logic\Producer\ProducerPriceRange;

use common\logic\ContainerInterface;
use common\logic\AbstractSingleton;

class ProducerPriceRangeContainer implements ContainerInterface
class ProducerPriceRangeContainer extends AbstractSingleton implements ContainerInterface
{
public function getEntityFqcn(): string
{

+ 2
- 2
common/logic/Producer/ProducerPriceRange/ProducerPriceRangeManager.php Просмотреть файл

@@ -2,13 +2,13 @@

namespace common\logic\Producer\ProducerPriceRange;

use common\logic\BaseManager;
use common\logic\AbstractManager;

/**
* @mixin ProducerPriceRangeRepository
* @mixin ProducerPriceRangeBuilder
*/
class ProducerPriceRangeManager extends BaseManager
class ProducerPriceRangeManager extends AbstractManager
{
public function __construct()
{

+ 2
- 2
common/logic/Producer/ProducerPriceRange/ProducerPriceRangeRepository.php Просмотреть файл

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

use common\helpers\Price;
use common\logic\BaseService;
use common\logic\AbstractService;
use common\logic\RepositoryInterface;

class ProducerPriceRangeRepository extends BaseService implements RepositoryInterface
class ProducerPriceRangeRepository extends AbstractService implements RepositoryInterface
{
/**
* Retourne les options de base nécessaires à la fonction de recherche.

+ 2
- 2
common/logic/Product/Product/ProductBuilder.php Просмотреть файл

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

namespace common\logic\Product\Product;

use common\logic\BaseBuilder;
use common\logic\AbstractBuilder;
use common\logic\BuilderInterface;

class ProductBuilder extends BaseBuilder implements BuilderInterface
class ProductBuilder extends AbstractBuilder implements BuilderInterface
{
public function instanciateProduct(): Product
{

+ 2
- 1
common/logic/Product/Product/ProductContainer.php Просмотреть файл

@@ -3,8 +3,9 @@
namespace common\logic\Product\Product;

use common\logic\ContainerInterface;
use common\logic\AbstractSingleton;

class ProductContainer implements ContainerInterface
class ProductContainer extends AbstractSingleton implements ContainerInterface
{
public function getEntityFqcn(): string
{

Некоторые файлы не были показаны из-за большого количества измененных файлов

Загрузка…
Отмена
Сохранить