Browse Source

Refactoring services #885

refactoring
Guillaume Bourgeois 1 year ago
parent
commit
65594867e5
100 changed files with 603 additions and 338 deletions
  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 View File



class BusinessLogic class BusinessLogic
{ {
use BusinessLogicContainerTrait;
use BusinessLogicTrait;


public function getContainers() public function getContainers()
{ {

common/components/BusinessLogicContainerTrait.php → common/components/BusinessLogicTrait.php View File

use common\logic\User\UserUserGroup\UserUserGroupContainer; use common\logic\User\UserUserGroup\UserUserGroupContainer;
use common\logic\User\UserUserGroup\UserUserGroupManager; use common\logic\User\UserUserGroup\UserUserGroupManager;


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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

+ 1
- 1
common/components/View.php View File



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


var $title ; var $title ;
var $page_title ; var $page_title ;

+ 2
- 2
common/controllers/CommonController.php View File

namespace common\controllers; namespace common\controllers;


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


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


public function beforeAction($event) public function beforeAction($event)
{ {

common/logic/BaseBuilder.php → common/logic/AbstractBuilder.php View File



use yii\db\ActiveRecord; use yii\db\ActiveRecord;


class BaseBuilder extends BaseService
abstract class AbstractBuilder extends AbstractService implements BuilderInterface
{ {
public function saveCreate(ActiveRecord $model): bool public function saveCreate(ActiveRecord $model): bool
{ {


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

+ 8
- 0
common/logic/AbstractContainer.php View File

<?php

namespace common\logic;

abstract class AbstractContainer extends AbstractSingleton implements ContainerInterface
{

}

common/logic/BaseManager.php → common/logic/AbstractManager.php View File



use yii\base\ErrorException; use yii\base\ErrorException;


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


foreach($this->getContainer()->getServices() as $serviceClass) { foreach($this->getContainer()->getServices() as $serviceClass) {
if(method_exists($serviceClass, $method)) { if(method_exists($serviceClass, $method)) {
return call_user_func_array( return call_user_func_array(
[new $serviceClass, $method],
[$serviceClass::getInstance(), $method],
$args $args
); );
} }
{ {
return $this->container; return $this->container;
} }

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

+ 8
- 0
common/logic/AbstractRepository.php View File

<?php

namespace common\logic;

abstract class AbstractRepository extends AbstractService implements RepositoryInterface
{

}

+ 8
- 0
common/logic/AbstractRepositoryQuery.php View File

<?php

namespace common\logic;

class AbstractRepositoryQuery extends AbstractService implements RepositoryQueryInterface
{

}

common/logic/BaseService.php → common/logic/AbstractService.php View File



use yii\base\ErrorException; use yii\base\ErrorException;


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


protected function loadDependencies(): void
{
}

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

+ 36
- 0
common/logic/AbstractSingleton.php View File

<?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 View File



namespace common\logic\Config\TaxRate; 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 public function instanciateTaxRate(): TaxRate
{ {

+ 4
- 4
common/logic/Config/TaxRate/TaxRateContainer.php View File



namespace common\logic\Config\TaxRate; 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 public function getEntityFqcn(): string
{ {


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


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

+ 4
- 4
common/logic/Config/TaxRate/TaxRateManager.php View File



namespace common\logic\Config\TaxRate; namespace common\logic\Config\TaxRate;


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


/** /**
* @mixin TaxRateRepository * @mixin TaxRateRepository
* @mixin TaxRateBuilder * @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 View File



namespace common\logic\Config\TaxRate; 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 public function getDefaultOptionsSearch(): array
{ {
return [ return [

+ 10
- 0
common/logic/Config/TaxRate/TaxRateRepositoryQuery.php View File

<?php

namespace common\logic\Config\TaxRate;

use common\logic\AbstractRepositoryQuery;

class TaxRateRepositoryQuery extends AbstractRepositoryQuery
{

}

+ 6
- 6
common/logic/Distribution/Distribution/DistributionBuilder.php View File



namespace common\logic\Distribution\Distribution; namespace common\logic\Distribution\Distribution;


use common\logic\BaseBuilder;
use common\logic\AbstractBuilder;
use common\logic\BuilderInterface; use common\logic\BuilderInterface;
use common\logic\Distribution\PointSaleDistribution\PointSaleDistribution; use common\logic\Distribution\PointSaleDistribution\PointSaleDistribution;
use common\logic\Distribution\PointSaleDistribution\PointSaleDistributionBuilder; use common\logic\Distribution\PointSaleDistribution\PointSaleDistributionBuilder;
use common\logic\User\UserProducer\UserProducerRepository; use common\logic\User\UserProducer\UserProducerRepository;
use yii\base\Event; use yii\base\Event;


class DistributionBuilder extends BaseBuilder implements BuilderInterface
class DistributionBuilder extends AbstractBuilder
{ {
protected DistributionRepository $distributionRepository; protected DistributionRepository $distributionRepository;
protected DistributionSolver $distributionSolver; protected DistributionSolver $distributionSolver;
protected UserProducerRepository $userProducerRepository; protected UserProducerRepository $userProducerRepository;
protected ProductOrderBuilder $productOrderBuilder; protected ProductOrderBuilder $productOrderBuilder;


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


public function createPointSaleDistributions(Distribution $distribution): void public function createPointSaleDistributions(Distribution $distribution): void
{ {
$countPointSaleDistribution = $this->pointSaleDistributionRepository->countPointSaleDistributionByDistribution($distribution);
$countPointSaleDistribution = $this->pointSaleDistributionRepository->countPointSaleDistributionsByDistribution($distribution);
if (!$countPointSaleDistribution) { if (!$countPointSaleDistribution) {
$this->pointSaleDistributionBuilder->createAllPointSaleDistributions($distribution, true); $this->pointSaleDistributionBuilder->createAllPointSaleDistributions($distribution, true);
} }
public function createProductDistributions(Distribution $distribution): void public function createProductDistributions(Distribution $distribution): void
{ {
$productArray = $this->productRepository->findProducts(); $productArray = $this->productRepository->findProducts();
$countProductDistribution = $this->productDistributionRepository->countProductDistributionByDistribution($distribution);
$countProductDistribution = $this->productDistributionRepository->countProductDistributionsByDistribution($distribution);


if (!$countProductDistribution) { if (!$countProductDistribution) {
foreach ($productArray as $product) { foreach ($productArray as $product) {
$userProducer = $this->userProducerRepository->findOneUserProducer($user, $distribution->producer); $userProducer = $this->userProducerRepository->findOneUserProducer($user, $distribution->producer);
} }


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

+ 5
- 5
common/logic/Distribution/Distribution/DistributionContainer.php View File



namespace common\logic\Distribution\Distribution; 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 public function getEntityFqcn(): string
{ {


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


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


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

+ 4
- 4
common/logic/Distribution/Distribution/DistributionManager.php View File



namespace common\logic\Distribution\Distribution; namespace common\logic\Distribution\Distribution;


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


/** /**
* @mixin DistributionSolver * @mixin DistributionSolver
* @mixin DistributionRepository * @mixin DistributionRepository
* @mixin DistributionBuilder * @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 View File

namespace common\logic\Distribution\Distribution; namespace common\logic\Distribution\Distribution;


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


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


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

+ 10
- 0
common/logic/Distribution/Distribution/DistributionRepositoryQuery.php View File

<?php

namespace common\logic\Distribution\Distribution;

use common\logic\AbstractRepositoryQuery;

class DistributionRepositoryQuery extends AbstractRepositoryQuery
{

}

+ 2
- 2
common/logic/Distribution/Distribution/DistributionSolver.php View File

namespace common\logic\Distribution\Distribution; namespace common\logic\Distribution\Distribution;


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


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

+ 3
- 4
common/logic/Distribution/PointSaleDistribution/PointSaleDistributionBuilder.php View File



namespace common\logic\Distribution\PointSaleDistribution; 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\Distribution;
use common\logic\Distribution\Distribution\DistributionRepository; use common\logic\Distribution\Distribution\DistributionRepository;
use common\logic\PointSale\PointSale\PointSale; use common\logic\PointSale\PointSale\PointSale;
use common\logic\PointSale\PointSale\PointSaleRepository; use common\logic\PointSale\PointSale\PointSaleRepository;


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


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

+ 4
- 4
common/logic/Distribution/PointSaleDistribution/PointSaleDistributionContainer.php View File



namespace common\logic\Distribution\PointSaleDistribution; 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 public function getEntityFqcn(): string
{ {


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


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

+ 4
- 4
common/logic/Distribution/PointSaleDistribution/PointSaleDistributionManager.php View File



namespace common\logic\Distribution\PointSaleDistribution; namespace common\logic\Distribution\PointSaleDistribution;


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


/** /**
* @mixin PointSaleDistributionRepository * @mixin PointSaleDistributionRepository
* @mixin PointSaleDistributionBuilder * @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 View File



namespace common\logic\Distribution\PointSaleDistribution; namespace common\logic\Distribution\PointSaleDistribution;


use common\logic\BaseService;
use common\logic\AbstractRepository;
use common\logic\Distribution\Distribution\Distribution; use common\logic\Distribution\Distribution\Distribution;
use common\logic\Distribution\Distribution\PointSaleDistributionRepositoryQuery;
use common\logic\PointSale\PointSale\PointSale; 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 public function getDefaultOptionsSearch(): array
{ {
return [ return [

+ 10
- 0
common/logic/Distribution/PointSaleDistribution/PointSaleDistributionRepositoryQuery.php View File

<?php

namespace common\logic\Distribution\Distribution;

use common\logic\AbstractRepositoryQuery;

class PointSaleDistributionRepositoryQuery extends AbstractRepositoryQuery
{

}

+ 3
- 3
common/logic/Distribution/ProductDistribution/ProductDistributionBuilder.php View File



namespace common\logic\Distribution\ProductDistribution; namespace common\logic\Distribution\ProductDistribution;


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


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


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

+ 4
- 4
common/logic/Distribution/ProductDistribution/ProductDistributionContainer.php View File



namespace common\logic\Distribution\ProductDistribution; 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 public function getEntityFqcn(): string
{ {


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


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

+ 4
- 4
common/logic/Distribution/ProductDistribution/ProductDistributionManager.php View File



namespace common\logic\Distribution\ProductDistribution; namespace common\logic\Distribution\ProductDistribution;


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


/** /**
* @mixin ProductDistributionRepository * @mixin ProductDistributionRepository
* @mixin ProductDistributionBuilder * @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 View File



namespace common\logic\Distribution\ProductDistribution; namespace common\logic\Distribution\ProductDistribution;


use common\logic\BaseService;
use common\logic\AbstractRepository;
use common\logic\Distribution\Distribution\Distribution; 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\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 public function getDefaultOptionsSearch(): array
{ {
return [ return [

+ 10
- 0
common/logic/Distribution/ProductDistribution/ProductDistributionRepositoryQuery.php View File

<?php

namespace common\logic\Distribution\Distribution;

use common\logic\AbstractRepositoryQuery;

class ProductDistributionRepositoryQuery extends AbstractRepositoryQuery
{

}

+ 1
- 3
common/logic/Document/DeliveryNote/DeliveryNoteBuilder.php View File



namespace common\logic\Document\DeliveryNote; namespace common\logic\Document\DeliveryNote;


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


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

+ 4
- 4
common/logic/Document/DeliveryNote/DeliveryNoteContainer.php View File



namespace common\logic\Document\DeliveryNote; 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 public function getEntityFqcn(): string
{ {


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


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

+ 2
- 2
common/logic/Document/DeliveryNote/DeliveryNoteManager.php View File

*/ */
class DeliveryNoteManager extends DocumentManager 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 View File



namespace common\logic\PointSale\PointSale; 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\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 public function getDefaultOptionsSearch(): array
{ {
return [ return [

+ 10
- 0
common/logic/Document/DeliveryNote/DeliveryNoteRepositoryQuery.php View File

<?php

namespace common\logic\Distribution\Distribution;

use common\logic\AbstractRepositoryQuery;

class DeliveryNoteRepositoryQuery extends AbstractRepositoryQuery
{

}

+ 1
- 1
common/logic/Document/DeliveryNote/DeliveryNoteSearch.php View File



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


$query = DeliveryNote::find() $query = DeliveryNote::find()

+ 0
- 1
common/logic/Document/DeliveryNote/DeliveryNoteSolver.php View File



namespace common\logic\Document\DeliveryNote; namespace common\logic\Document\DeliveryNote;


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

+ 3
- 7
common/logic/Document/Document/DocumentBuilder.php View File



namespace common\logic\Document\Document; 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 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 DocumentSolver $documentSolver;
protected ProducerRepository $producerRepository; protected ProducerRepository $producerRepository;


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

+ 5
- 5
common/logic/Document/Document/DocumentContainer.php View File



namespace common\logic\Document\Document; 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 public function getEntityFqcn(): string
{ {


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


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


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

+ 4
- 4
common/logic/Document/Document/DocumentManager.php View File



namespace common\logic\Document\Document; namespace common\logic\Document\Document;


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


/** /**
* @mixin DocumentSolver * @mixin DocumentSolver
* @mixin DocumentBuilder * @mixin DocumentBuilder
* @mixin DocumentUtils * @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 View File

namespace common\logic\Document\Document; namespace common\logic\Document\Document;


use common\helpers\Price; use common\helpers\Price;
use common\logic\BaseService;
use common\logic\AbstractService;
use common\logic\Order\Order\Order; use common\logic\Order\Order\Order;
use common\logic\PointSale\PointSale\PointSale; use common\logic\PointSale\PointSale\PointSale;
use common\logic\SolverInterface; 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) public function getAmount(DocumentInterface $document, string $type = Order::AMOUNT_TOTAL, bool $format = false)
{ {

+ 3
- 3
common/logic/Document/Document/DocumentUtils.php View File

namespace common\logic\Document\Document; namespace common\logic\Document\Document;


use common\helpers\GlobalParam; use common\helpers\GlobalParam;
use common\logic\BaseService;
use common\logic\AbstractService;
use common\logic\Producer\Producer\ProducerRepository; use common\logic\Producer\Producer\ProducerRepository;
use common\logic\Producer\Producer\ProducerSolver; use common\logic\Producer\Producer\ProducerSolver;
use common\logic\UtilsInterface; use common\logic\UtilsInterface;
use yii\base\ErrorException; use yii\base\ErrorException;
use yii\helpers\Html; use yii\helpers\Html;


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


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

+ 1
- 3
common/logic/Document/Invoice/InvoiceBuilder.php View File



namespace common\logic\Document\Invoice; namespace common\logic\Document\Invoice;


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


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

+ 5
- 6
common/logic/Document/Invoice/InvoiceContainer.php View File



namespace common\logic\Document\Invoice; 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\Document\DocumentSolver;
use common\logic\PointSale\PointSale\InvoiceRepository; use common\logic\PointSale\PointSale\InvoiceRepository;


class InvoiceContainer implements ContainerInterface
class InvoiceContainer extends AbstractContainer
{ {
public function getEntityFqcn(): string public function getEntityFqcn(): string
{ {


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


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


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

+ 2
- 2
common/logic/Document/Invoice/InvoiceManager.php View File

*/ */
class InvoiceManager extends DocumentManager 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 View File



namespace common\logic\PointSale\PointSale; 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\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 public function getDefaultOptionsSearch(): array
{ {
return [ return [

+ 10
- 0
common/logic/Document/Invoice/InvoiceRepositoryQuery.php View File

<?php

namespace common\logic\Distribution\Distribution;

use common\logic\AbstractRepositoryQuery;

class InvoiceRepositoryQuery extends AbstractRepositoryQuery
{

}

+ 4
- 1
common/logic/Document/Invoice/InvoiceSearch.php View File

namespace common\logic\Document\Invoice; namespace common\logic\Document\Invoice;


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


class InvoiceSearch extends Invoice class InvoiceSearch extends Invoice
{ {


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


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

+ 2
- 3
common/logic/Document/Quotation/QuotationBuilder.php View File



namespace common\logic\Document\Quotation; 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 public function instanciateQuotation(): Quotation
{ {

+ 5
- 7
common/logic/Document/Quotation/QuotationContainer.php View File



namespace common\logic\Document\Invoice; 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\Document\DocumentSolver;
use common\logic\Document\Quotation\QuotationBuilder; use common\logic\Document\Quotation\QuotationBuilder;
use common\logic\Document\Quotation\QuotationFactory;
use common\logic\Document\Quotation\Quotation; use common\logic\Document\Quotation\Quotation;
use common\logic\PointSale\PointSale\QuotationRepository; use common\logic\PointSale\PointSale\QuotationRepository;


class QuotationContainer implements ContainerInterface
class QuotationContainer extends AbstractContainer
{ {
public function getEntityFqcn(): string public function getEntityFqcn(): string
{ {


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


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

+ 2
- 2
common/logic/Document/Quotation/QuotationManager.php View File

*/ */
class QuotationManager extends DocumentManager 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 View File



namespace common\logic\PointSale\PointSale; 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 public function getDefaultOptionsSearch(): array
{ {
return [ return [

+ 10
- 0
common/logic/Document/Quotation/QuotationRepositoryQuery.php View File

<?php

namespace common\logic\Distribution\Distribution;

use common\logic\AbstractRepositoryQuery;

class QuotationRepositoryQuery extends AbstractRepositoryQuery
{

}

+ 36
- 34
common/logic/Document/Quotation/QuotationSearch.php View File

namespace common\logic\Document\Quotation; namespace common\logic\Document\Quotation;


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


class QuotationSearch extends Quotation 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 View File

<?php

namespace common\logic;

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

+ 4
- 4
common/logic/Order/Order/OrderBuilder.php View File

use common\helpers\GlobalParam; use common\helpers\GlobalParam;
use common\helpers\MeanPayment; use common\helpers\MeanPayment;
use common\helpers\Price; 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\BuilderInterface;
use common\logic\Config\TaxRate\TaxRate; use common\logic\Config\TaxRate\TaxRate;
use common\logic\Distribution\Distribution\Distribution; use common\logic\Distribution\Distribution\Distribution;
use common\logic\User\UserProducer\UserProducerRepository; use common\logic\User\UserProducer\UserProducerRepository;
use yii\web\NotFoundHttpException; use yii\web\NotFoundHttpException;


class OrderBuilder extends BaseBuilder implements BuilderInterface
class OrderBuilder extends AbstractBuilder
{ {
protected UserSolver $userSolver; protected UserSolver $userSolver;
protected OrderSolver $orderSolver; protected OrderSolver $orderSolver;
protected SubscriptionRepository $subscriptionRepository; protected SubscriptionRepository $subscriptionRepository;
protected SubscriptionSolver $subscriptionSolver; protected SubscriptionSolver $subscriptionSolver;


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

+ 6
- 6
common/logic/Order/Order/OrderContainer.php View File



namespace common\logic\Order\Order; 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 public function getEntityFqcn(): string
{ {


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


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


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


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

+ 4
- 4
common/logic/Order/Order/OrderManager.php View File



namespace common\logic\Order\Order; namespace common\logic\Order\Order;


use common\logic\BaseManager;
use common\logic\AbstractManager;
use common\logic\Config\TaxRate\TaxRate; use common\logic\Config\TaxRate\TaxRate;
use common\logic\Distribution\Distribution\Distribution; use common\logic\Distribution\Distribution\Distribution;
use common\logic\Document\Document\Document; use common\logic\Document\Document\Document;
* @mixin OrderRepository * @mixin OrderRepository
* @mixin OrderBuilder * @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 View File



namespace common\logic\Order\Order; namespace common\logic\Order\Order;


use common\logic\BaseService;
use common\logic\AbstractRepository;
use common\logic\Distribution\Distribution\Distribution; 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\Distribution\ProductDistribution\ProductDistributionRepository;
use common\logic\Order\ProductOrder\ProductOrder;
use common\logic\Order\ProductOrder\ProductOrderRepository; use common\logic\Order\ProductOrder\ProductOrderRepository;
use common\logic\Producer\Producer\Producer; use common\logic\Producer\Producer\Producer;
use common\logic\Producer\Producer\ProducerRepository; use common\logic\Producer\Producer\ProducerRepository;
use common\logic\Product\Product\Product; use common\logic\Product\Product\Product;
use common\logic\RepositoryInterface;
use common\logic\User\User\User; use common\logic\User\User\User;
use yii\helpers\Html; use yii\helpers\Html;


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


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

+ 10
- 0
common/logic/Order/Order/OrderRepositoryQuery.php View File

<?php

namespace common\logic\Distribution\Distribution;

use common\logic\AbstractRepositoryQuery;

class OrderRepositoryQuery extends AbstractRepositoryQuery
{

}

+ 4
- 1
common/logic/Order/Order/OrderSearch.php View File



namespace common\logic\Order\Order ; namespace common\logic\Order\Order ;


use yii\data\ActiveDataProvider;

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


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

+ 3
- 3
common/logic/Order/Order/OrderSolver.php View File



use common\helpers\GlobalParam; use common\helpers\GlobalParam;
use common\helpers\Price; use common\helpers\Price;
use common\logic\BaseService;
use common\logic\AbstractService;
use common\logic\Document\Document\Document; use common\logic\Document\Document\Document;
use common\logic\Document\Document\DocumentSolver; use common\logic\Document\Document\DocumentSolver;
use common\logic\Order\ProductOrder\ProductOrder; use common\logic\Order\ProductOrder\ProductOrder;
use yii\helpers\Html; use yii\helpers\Html;




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


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

+ 2
- 2
common/logic/Order/Order/OrderUtils.php View File



namespace common\logic\Order\Order; namespace common\logic\Order\Order;


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


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

+ 3
- 4
common/logic/Order/OrderStatusHistory/OrderStatusHistoryBuilder.php View File



namespace common\logic\Order\OrderStatusHistory; 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\Order\Order\Order;
use common\logic\User\User\User; use common\logic\User\User\User;
use common\logic\User\User\UserSolver; use common\logic\User\User\UserSolver;


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


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

+ 4
- 4
common/logic/Order/OrderStatusHistory/OrderStatusHistoryContainer.php View File



namespace common\logic\Order\OrderStatusHistory; namespace common\logic\Order\OrderStatusHistory;


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


class OrderStatusHistoryContainer implements ContainerInterface
class OrderStatusHistoryContainer extends AbstractContainer
{ {
public function getEntityFqcn(): string public function getEntityFqcn(): string
{ {


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


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

+ 4
- 4
common/logic/Order/OrderStatusHistory/OrderStatusHistoryManager.php View File



namespace common\logic\Order\OrderStatusHistory; namespace common\logic\Order\OrderStatusHistory;


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


/** /**
* @mixin OrderStatusHistoryRepository * @mixin OrderStatusHistoryRepository
* @mixin OrderStatusHistoryBuilder * @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 View File



namespace common\logic\PointSale\PointSale; 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 public function getDefaultOptionsSearch(): array
{ {
return [ return [

+ 10
- 0
common/logic/Order/OrderStatusHistory/OrderStatusHistoryRepositoryQuery.php View File

<?php

namespace common\logic\Distribution\Distribution;

use common\logic\AbstractRepositoryQuery;

class OrderStatusHistoryRepositoryQuery extends AbstractRepositoryQuery
{

}

+ 4
- 4
common/logic/Order/ProductOrder/ProductOrderBuilder.php View File



namespace common\logic\Order\ProductOrder; 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\BuilderInterface;
use common\logic\Config\TaxRate\TaxRate; use common\logic\Config\TaxRate\TaxRate;
use common\logic\Order\Order\Order; use common\logic\Order\Order\Order;
use common\logic\User\User\User; use common\logic\User\User\User;
use common\logic\User\UserProducer\UserProducer; use common\logic\User\UserProducer\UserProducer;


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


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

+ 5
- 6
common/logic/Order/ProductOrder/ProductOrderContainer.php View File



namespace common\logic\Order\ProductOrder; 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 public function getEntityFqcn(): string
{ {


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


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


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

+ 4
- 4
common/logic/Order/ProductOrder/ProductOrderManager.php View File



namespace common\logic\Order\ProductOrder; namespace common\logic\Order\ProductOrder;


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


/** /**
* @mixin ProductOrderSolver * @mixin ProductOrderSolver
* @mixin ProductOrderRepository * @mixin ProductOrderRepository
* @mixin ProductOrderBuilder * @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 View File



namespace common\logic\Order\ProductOrder; 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\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 public function getDefaultOptionsSearch(): array
{ {
return [ return [

+ 10
- 0
common/logic/Order/ProductOrder/ProductOrderRepositoryQuery.php View File

<?php

namespace common\logic\Distribution\Distribution;

use common\logic\AbstractRepositoryQuery;

class ProductOrderRepositoryQuery extends AbstractRepositoryQuery
{

}

+ 2
- 2
common/logic/Order/ProductOrder/ProductOrderSolver.php View File

namespace common\logic\Order\ProductOrder; namespace common\logic\Order\ProductOrder;


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


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

+ 4
- 4
common/logic/PointSale/PointSale/PointSaleBuilder.php View File



namespace common\logic\PointSale\PointSale; 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\BuilderInterface;
use common\logic\PointSale\UserPointSale\UserPointSale; use common\logic\PointSale\UserPointSale\UserPointSale;
use common\logic\PointSale\UserPointSale\UserPointSaleBuilder; use common\logic\PointSale\UserPointSale\UserPointSaleBuilder;
use common\logic\User\User\User; use common\logic\User\User\User;
use common\logic\User\User\UserRepository; use common\logic\User\User\UserRepository;


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


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

+ 5
- 5
common/logic/PointSale/PointSale/PointSaleContainer.php View File



namespace common\logic\PointSale\PointSale; 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 public function getEntityFqcn(): string
{ {


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


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


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

+ 4
- 4
common/logic/PointSale/PointSale/PointSaleManager.php View File



namespace common\logic\PointSale\PointSale; namespace common\logic\PointSale\PointSale;


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


/** /**
* @mixin PointSaleSolver * @mixin PointSaleSolver
* @mixin PointSaleRepository * @mixin PointSaleRepository
* @mixin PointSaleBuilder * @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 View File

namespace common\logic\PointSale\PointSale; namespace common\logic\PointSale\PointSale;


use common\helpers\GlobalParam; use common\helpers\GlobalParam;
use common\logic\BaseService;
use common\logic\AbstractRepository;
use common\logic\AbstractService;
use common\logic\BuilderInterface; use common\logic\BuilderInterface;
use common\logic\Distribution\Distribution\Distribution; use common\logic\Distribution\Distribution\Distribution;
use common\logic\Distribution\Distribution\PointSaleRepositoryQuery;
use common\logic\Producer\Producer\Producer; use common\logic\Producer\Producer\Producer;
use common\logic\RepositoryInterface; 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 public function getDefaultOptionsSearch(): array
{ {
return [ return [

+ 10
- 0
common/logic/PointSale/PointSale/PointSaleRepositoryQuery.php View File

<?php

namespace common\logic\Distribution\Distribution;

use common\logic\AbstractRepositoryQuery;

class PointSaleRepositoryQuery extends AbstractRepositoryQuery
{

}

+ 3
- 1
common/logic/PointSale/PointSale/PointSaleSearch.php View File

namespace common\logic\PointSale\PointSale ; namespace common\logic\PointSale\PointSale ;


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


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

+ 2
- 2
common/logic/PointSale/PointSale/PointSaleSolver.php View File

namespace common\logic\PointSale\PointSale; namespace common\logic\PointSale\PointSale;


use common\helpers\GlobalParam; use common\helpers\GlobalParam;
use common\logic\BaseService;
use common\logic\AbstractService;
use common\logic\SolverInterface; use common\logic\SolverInterface;
use yii\helpers\Html; 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. * Retourne le commentaire de l'utilisateur courant lié au point de vente.

+ 3
- 3
common/logic/PointSale/UserPointSale/UserPointSaleBuilder.php View File



namespace common\logic\PointSale\UserPointSale; namespace common\logic\PointSale\UserPointSale;


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


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


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

+ 4
- 5
common/logic/PointSale/UserPointSale/UserPointSaleContainer.php View File



namespace common\logic\PointSale\UserPointSale; 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 public function getEntityFqcn(): string
{ {


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


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

+ 4
- 4
common/logic/PointSale/UserPointSale/UserPointSaleManager.php View File



namespace common\logic\PointSale\UserPointSale; namespace common\logic\PointSale\UserPointSale;


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


/** /**
* @mixin UserPointSaleRepository * @mixin UserPointSaleRepository
* @mixin UserPointSaleBuilder * @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 View File



namespace common\logic\PointSale\UserPointSale; 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\PointSale\PointSale\PointSale;
use common\logic\RepositoryInterface;
use common\logic\User\User\User; 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 public function getDefaultOptionsSearch(): array
{ {
return [ return [

+ 10
- 0
common/logic/PointSale/UserPointSale/UserPointSaleRepositoryQuery.php View File

<?php

namespace common\logic\Distribution\Distribution;

use common\logic\AbstractRepositoryQuery;

class UserPointSaleRepositoryQuery extends AbstractRepositoryQuery
{

}

+ 3
- 3
common/logic/Producer/Producer/ProducerBuilder.php View File



use common\helpers\Opendistrib; use common\helpers\Opendistrib;
use common\helpers\Password; 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\BuilderInterface;
use common\logic\User\User\User; use common\logic\User\User\User;
use common\logic\User\UserProducer\UserProducer; use common\logic\User\UserProducer\UserProducer;
use common\logic\User\UserProducer\UserProducerRepository; use common\logic\User\UserProducer\UserProducerRepository;
use common\helpers\Url; use common\helpers\Url;


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

+ 2
- 1
common/logic/Producer/Producer/ProducerContainer.php View File

namespace common\logic\Producer\Producer; namespace common\logic\Producer\Producer;


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


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

+ 2
- 2
common/logic/Producer/Producer/ProducerManager.php View File



namespace common\logic\Producer\Producer; namespace common\logic\Producer\Producer;


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


/** /**
* @mixin ProducerSolver * @mixin ProducerSolver
* @mixin ProducerBuilder * @mixin ProducerBuilder
* @mixin ProducerUtils * @mixin ProducerUtils
*/ */
class ProducerManager extends BaseManager
class ProducerManager extends AbstractManager
{ {
public function __construct() public function __construct()
{ {

+ 2
- 2
common/logic/Producer/Producer/ProducerRepository.php View File

use common\helpers\Departments; use common\helpers\Departments;
use common\helpers\GlobalParam; use common\helpers\GlobalParam;
use common\helpers\Price; use common\helpers\Price;
use common\logic\BaseService;
use common\logic\AbstractService;
use common\logic\Document\Document\DocumentInterface; use common\logic\Document\Document\DocumentInterface;
use common\logic\Document\Document\DocumentSolver; use common\logic\Document\Document\DocumentSolver;
use common\logic\PointSale\PointSale\PointSale; use common\logic\PointSale\PointSale\PointSale;
use common\logic\User\User\User; use common\logic\User\User\User;
use yii\helpers\Html; use yii\helpers\Html;


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

+ 2
- 2
common/logic/Producer/Producer/ProducerSolver.php View File

namespace common\logic\Producer\Producer; namespace common\logic\Producer\Producer;


use common\helpers\GlobalParam; use common\helpers\GlobalParam;
use common\logic\BaseService;
use common\logic\AbstractService;
use common\logic\SolverInterface; use common\logic\SolverInterface;
use common\logic\User\User\User; 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 View File



namespace common\logic\Producer\Producer; namespace common\logic\Producer\Producer;


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


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

+ 2
- 2
common/logic/Producer/ProducerPriceRange/ProducerPriceRangeBuilder.php View File



namespace common\logic\Producer\ProducerPriceRange; 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 public function instanciateProducerPriceRange(): ProducerPriceRange
{ {

+ 2
- 1
common/logic/Producer/ProducerPriceRange/ProducerPriceRangeContainer.php View File

namespace common\logic\Producer\ProducerPriceRange; namespace common\logic\Producer\ProducerPriceRange;


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


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

+ 2
- 2
common/logic/Producer/ProducerPriceRange/ProducerPriceRangeManager.php View File



namespace common\logic\Producer\ProducerPriceRange; namespace common\logic\Producer\ProducerPriceRange;


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


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

+ 2
- 2
common/logic/Producer/ProducerPriceRange/ProducerPriceRangeRepository.php View File

namespace common\logic\Producer\ProducerPriceRange; namespace common\logic\Producer\ProducerPriceRange;


use common\helpers\Price; use common\helpers\Price;
use common\logic\BaseService;
use common\logic\AbstractService;
use common\logic\RepositoryInterface; 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. * Retourne les options de base nécessaires à la fonction de recherche.

+ 2
- 2
common/logic/Product/Product/ProductBuilder.php View File



namespace common\logic\Product\Product; namespace common\logic\Product\Product;


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


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

+ 2
- 1
common/logic/Product/Product/ProductContainer.php View File

namespace common\logic\Product\Product; namespace common\logic\Product\Product;


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


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

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

Loading…
Cancel
Save