class BusinessLogic | class BusinessLogic | ||||
{ | { | ||||
use BusinessLogicContainerTrait; | |||||
use BusinessLogicTrait; | |||||
public function getContainers() | public function getContainers() | ||||
{ | { |
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(); | |||||
} | } | ||||
} | } |
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 ; |
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) | ||||
{ | { |
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(); | |||||
} | } | ||||
} | } |
<?php | |||||
namespace common\logic; | |||||
abstract class AbstractContainer extends AbstractSingleton implements ContainerInterface | |||||
{ | |||||
} |
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); | |||||
} | |||||
} | } |
<?php | |||||
namespace common\logic; | |||||
abstract class AbstractRepository extends AbstractService implements RepositoryInterface | |||||
{ | |||||
} |
<?php | |||||
namespace common\logic; | |||||
class AbstractRepositoryQuery extends AbstractService implements RepositoryQueryInterface | |||||
{ | |||||
} |
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; |
<?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]; | |||||
} | |||||
} |
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 | ||||
{ | { |
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(); | |||||
} | } | ||||
} | } |
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; | |||||
} | } | ||||
} | } |
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 [ |
<?php | |||||
namespace common\logic\Config\TaxRate; | |||||
use common\logic\AbstractRepositoryQuery; | |||||
class TaxRateRepositoryQuery extends AbstractRepositoryQuery | |||||
{ | |||||
} |
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, |
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(); | |||||
} | } | ||||
} | } |
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; | |||||
} | } | ||||
} | } |
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); | ||||
} | } |
<?php | |||||
namespace common\logic\Distribution\Distribution; | |||||
use common\logic\AbstractRepositoryQuery; | |||||
class DistributionRepositoryQuery extends AbstractRepositoryQuery | |||||
{ | |||||
} |
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 | ||||
{ | { |
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); |
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(); | |||||
} | } | ||||
} | } |
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; | |||||
} | } | ||||
} | } |
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 [ |
<?php | |||||
namespace common\logic\Distribution\Distribution; | |||||
use common\logic\AbstractRepositoryQuery; | |||||
class PointSaleDistributionRepositoryQuery extends AbstractRepositoryQuery | |||||
{ | |||||
} |
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); |
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(); | |||||
} | } | ||||
} | } |
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; | |||||
} | } | ||||
} | } |
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 [ |
<?php | |||||
namespace common\logic\Distribution\Distribution; | |||||
use common\logic\AbstractRepositoryQuery; | |||||
class ProductDistributionRepositoryQuery extends AbstractRepositoryQuery | |||||
{ | |||||
} |
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 | ||||
{ | { |
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(); | |||||
} | } | ||||
} | } |
*/ | */ | ||||
class DeliveryNoteManager extends DocumentManager | class DeliveryNoteManager extends DocumentManager | ||||
{ | { | ||||
public function __construct() | |||||
public function getContainerFqcn(): string | |||||
{ | { | ||||
$this->setContainer(new DeliveryNoteContainer()); | |||||
return DeliveryNoteContainer::class; | |||||
} | } | ||||
} | } |
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 [ |
<?php | |||||
namespace common\logic\Distribution\Distribution; | |||||
use common\logic\AbstractRepositoryQuery; | |||||
class DeliveryNoteRepositoryQuery extends AbstractRepositoryQuery | |||||
{ | |||||
} |
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() |
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; |
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); |
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(); | |||||
} | } | ||||
} | } |
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; | |||||
} | } | ||||
} | } |
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) | ||||
{ | { |
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); |
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 | ||||
{ | { |
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(); | |||||
} | } | ||||
} | } |
*/ | */ | ||||
class InvoiceManager extends DocumentManager | class InvoiceManager extends DocumentManager | ||||
{ | { | ||||
public function __construct() | |||||
public function getContainerFqcn(): string | |||||
{ | { | ||||
$this->setContainer(new InvoiceContainer()); | |||||
return InvoiceContainer::class; | |||||
} | } | ||||
} | } |
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 [ |
<?php | |||||
namespace common\logic\Distribution\Distribution; | |||||
use common\logic\AbstractRepositoryQuery; | |||||
class InvoiceRepositoryQuery extends AbstractRepositoryQuery | |||||
{ | |||||
} |
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']) |
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 | ||||
{ | { |
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(); | |||||
} | } | ||||
} | } |
*/ | */ | ||||
class QuotationManager extends DocumentManager | class QuotationManager extends DocumentManager | ||||
{ | { | ||||
public function __construct() | |||||
public function getContainerFqcn(): string | |||||
{ | { | ||||
$this->setContainer(new QuotationContainer()); | |||||
return QuotationContainer::class; | |||||
} | } | ||||
} | } |
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 [ |
<?php | |||||
namespace common\logic\Distribution\Distribution; | |||||
use common\logic\AbstractRepositoryQuery; | |||||
class QuotationRepositoryQuery extends AbstractRepositoryQuery | |||||
{ | |||||
} |
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; | |||||
} | |||||
} | } |
<?php | |||||
namespace common\logic; | |||||
interface ManagerInterface | |||||
{ | |||||
public function getContainerFqcn(): string; | |||||
} |
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); |
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(); | |||||
} | } | ||||
} | } |
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; | |||||
} | } | ||||
} | } |
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); |
<?php | |||||
namespace common\logic\Distribution\Distribution; | |||||
use common\logic\AbstractRepositoryQuery; | |||||
class OrderRepositoryQuery extends AbstractRepositoryQuery | |||||
{ | |||||
} |
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'])) { |
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); |
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 | |||||
{ | { | ||||
} | } |
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); | ||||
} | } |
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(); | |||||
} | } | ||||
} | } |
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; | |||||
} | } | ||||
} | } |
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 [ |
<?php | |||||
namespace common\logic\Distribution\Distribution; | |||||
use common\logic\AbstractRepositoryQuery; | |||||
class OrderStatusHistoryRepositoryQuery extends AbstractRepositoryQuery | |||||
{ | |||||
} |
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); | ||||
} | } |
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(); | |||||
} | } | ||||
} | } |
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; | |||||
} | } | ||||
} | } |
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 [ |
<?php | |||||
namespace common\logic\Distribution\Distribution; | |||||
use common\logic\AbstractRepositoryQuery; | |||||
class ProductOrderRepositoryQuery extends AbstractRepositoryQuery | |||||
{ | |||||
} |
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 |
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); |
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(); | |||||
} | } | ||||
} | } |
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; | |||||
} | } | ||||
} | } |
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 [ |
<?php | |||||
namespace common\logic\Distribution\Distribution; | |||||
use common\logic\AbstractRepositoryQuery; | |||||
class PointSaleRepositoryQuery extends AbstractRepositoryQuery | |||||
{ | |||||
} |
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']) |
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. |
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); | ||||
} | } |
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(); | |||||
} | } | ||||
} | } |
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; | |||||
} | } | ||||
} | } |
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 [ |
<?php | |||||
namespace common\logic\Distribution\Distribution; | |||||
use common\logic\AbstractRepositoryQuery; | |||||
class UserPointSaleRepositoryQuery extends AbstractRepositoryQuery | |||||
{ | |||||
} |
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; |
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 | ||||
{ | { |
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() | ||||
{ | { |
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; |
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 | |||||
{ | { | ||||
/** | /** |
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 | ||||
{ | { |
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 | ||||
{ | { |
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 | ||||
{ | { |
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() | ||||
{ | { |
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. |
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 | ||||
{ | { |
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 | ||||
{ | { |