Browse Source

Refactoring services #885

refactoring
Guillaume 1 year ago
parent
commit
a4408798ec
62 changed files with 314 additions and 311 deletions
  1. +0
    -6
      common/logic/BaseService.php
  2. +3
    -3
      common/logic/Config/TaxRate/TaxRateBuilder.php
  3. +3
    -3
      common/logic/Config/TaxRate/TaxRateContainer.php
  4. +2
    -2
      common/logic/Distribution/ProductDistribution/ProductDistributionBuilder.php
  5. +3
    -3
      common/logic/Document/DeliveryNote/DeliveryNoteBuilder.php
  6. +11
    -0
      common/logic/Document/DeliveryNote/DeliveryNoteRepository.php
  7. +17
    -0
      common/logic/Document/Invoice/InvoiceBuilder.php
  8. +9
    -7
      common/logic/Document/Invoice/InvoiceContainer.php
  9. +0
    -16
      common/logic/Document/Invoice/InvoiceFactory.php
  10. +11
    -0
      common/logic/Document/Invoice/InvoiceRepository.php
  11. +3
    -3
      common/logic/Document/Quotation/QuotationBuilder.php
  12. +10
    -8
      common/logic/Document/Quotation/QuotationContainer.php
  13. +11
    -0
      common/logic/Document/Quotation/QuotationRepository.php
  14. +0
    -8
      common/logic/FactoryInterface.php
  15. +6
    -1
      common/logic/Order/Order/OrderBuilder.php
  16. +0
    -6
      common/logic/Order/Order/OrderContainer.php
  17. +0
    -16
      common/logic/Order/Order/OrderFactory.php
  18. +3
    -3
      common/logic/Order/OrderStatusHistory/OrderStatusHistoryBuilder.php
  19. +10
    -3
      common/logic/Order/OrderStatusHistory/OrderStatusHistoryContainer.php
  20. +11
    -0
      common/logic/Order/OrderStatusHistory/OrderStatusHistoryRepository.php
  21. +3
    -3
      common/logic/Order/ProductOrder/ProductOrderBuilder.php
  22. +12
    -5
      common/logic/Order/ProductOrder/ProductOrderContainer.php
  23. +11
    -0
      common/logic/Order/ProductOrder/ProductOrderRepository.php
  24. +6
    -1
      common/logic/PointSale/PointSale/PointSaleBuilder.php
  25. +0
    -6
      common/logic/PointSale/PointSale/PointSaleContainer.php
  26. +0
    -16
      common/logic/PointSale/PointSale/PointSaleFactory.php
  27. +3
    -3
      common/logic/PointSale/UserPointSale/UserPointSaleBuilder.php
  28. +10
    -3
      common/logic/PointSale/UserPointSale/UserPointSaleContainer.php
  29. +12
    -0
      common/logic/PointSale/UserPointSale/UserPointSaleRepository.php
  30. +10
    -0
      common/logic/Producer/Producer/ProducerBuilder.php
  31. +0
    -6
      common/logic/Producer/Producer/ProducerContainer.php
  32. +0
    -19
      common/logic/Producer/Producer/ProducerFactory.php
  33. +6
    -1
      common/logic/Product/Product/ProductBuilder.php
  34. +4
    -7
      common/logic/Product/Product/ProductContainer.php
  35. +0
    -16
      common/logic/Product/Product/ProductFactory.php
  36. +3
    -3
      common/logic/Product/ProductCategory/ProductCategoryBuilder.php
  37. +3
    -3
      common/logic/Product/ProductCategory/ProductCategoryContainer.php
  38. +3
    -3
      common/logic/Product/ProductPointSale/ProductPointSaleBuilder.php
  39. +10
    -3
      common/logic/Product/ProductPointSale/ProductPointSaleContainer.php
  40. +11
    -0
      common/logic/Product/ProductPointSale/ProductPointSaleRepository.php
  41. +3
    -3
      common/logic/Product/ProductPrice/ProductPriceBuilder.php
  42. +2
    -3
      common/logic/Product/ProductPrice/ProductPriceContainer.php
  43. +3
    -3
      common/logic/Subscription/ProductSubscription/ProductSubscriptionBuilder.php
  44. +3
    -3
      common/logic/Subscription/ProductSubscription/ProductSubscriptionContainer.php
  45. +5
    -0
      common/logic/Subscription/Subscription/SubscriptionBuilder.php
  46. +0
    -6
      common/logic/Subscription/Subscription/SubscriptionContainer.php
  47. +0
    -16
      common/logic/Subscription/Subscription/SubscriptionFactory.php
  48. +7
    -0
      common/logic/User/CreditHistory/CreditHistoryBuilder.php
  49. +0
    -6
      common/logic/User/CreditHistory/CreditHistoryContainer.php
  50. +0
    -15
      common/logic/User/CreditHistory/CreditHistoryFactory.php
  51. +7
    -0
      common/logic/User/User/UserBuilder.php
  52. +0
    -6
      common/logic/User/User/UserContainer.php
  53. +0
    -16
      common/logic/User/User/UserFactory.php
  54. +3
    -3
      common/logic/User/UserGroup/UserGroupBuilder.php
  55. +3
    -3
      common/logic/User/UserGroup/UserGroupContainer.php
  56. +13
    -0
      common/logic/User/UserProducer/UserProducerBuilder.php
  57. +7
    -1
      common/logic/User/UserProducer/UserProducerContainer.php
  58. +0
    -21
      common/logic/User/UserProducer/UserProducerFactory.php
  59. +16
    -0
      common/logic/User/UserUserGroup/UserUserGroupBuilder.php
  60. +11
    -4
      common/logic/User/UserUserGroup/UserUserGroupContainer.php
  61. +0
    -16
      common/logic/User/UserUserGroup/UserUserGroupFactory.php
  62. +11
    -0
      common/logic/User/UserUserGroup/UserUserGroupRepository.php

+ 0
- 6
common/logic/BaseService.php View File

@@ -9,7 +9,6 @@ class BaseService
public function getHierarchy(): array
{
return [
FactoryInterface::class,
SolverInterface::class,
RepositoryInterface::class,
BuilderInterface::class,
@@ -61,11 +60,6 @@ class BaseService
FactoryInterface, SolverInterface ou BuilderInterface au service.');
}

public function isFactory(): bool
{
return $this->classImplementsInterface(FactoryInterface::class);
}

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

common/logic/Config/TaxRate/TaxRateFactory.php → common/logic/Config/TaxRate/TaxRateBuilder.php View File

@@ -3,11 +3,11 @@
namespace common\logic\Config\TaxRate;

use common\logic\BaseService;
use common\logic\FactoryInterface;
use common\logic\BuilderInterface;

class TaxRateFactory extends BaseService implements FactoryInterface
class TaxRateBuilder extends BaseService implements BuilderInterface
{
public function create(): TaxRate
public function instanciate(): TaxRate
{
$taxRate = new TaxRate();


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

@@ -14,14 +14,14 @@ class TaxRateContainer implements ContainerInterface
public function getServices(): array
{
return [
TaxRateFactory::class,
TaxRateBuilder::class,
TaxRateRepository::class,
];
}

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

public function getRepository(): TaxRateRepository

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

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

use common\logic\BaseService;
use common\logic\BuilderInterface;
use common\logic\Distribution\Distribution\Distribution;
use common\logic\Distribution\Distribution\DistributionSolver;
use common\logic\FactoryInterface;
use common\logic\Product\Product\Product;

class ProductDistributionBuilder extends BaseService implements FactoryInterface
class ProductDistributionBuilder extends BaseService implements BuilderInterface
{
protected ProductDistributionRepository $productDistributionRepository;
protected DistributionSolver $distributionSolver;

common/logic/Document/DeliveryNote/DeliveryNoteFactory.php → common/logic/Document/DeliveryNote/DeliveryNoteBuilder.php View File

@@ -3,11 +3,11 @@
namespace common\logic\Document\DeliveryNote;

use common\logic\BaseService;
use common\logic\FactoryInterface;
use common\logic\BuilderInterface;

class DeliveryNoteFactory extends BaseService implements FactoryInterface
class DeliveryNoteBuilder extends BaseService implements BuilderInterface
{
public function create(): DeliveryNote
public function instanciate(): DeliveryNote
{
$deliveryNote = new DeliveryNote();


+ 11
- 0
common/logic/Document/DeliveryNote/DeliveryNoteRepository.php View File

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

namespace common\logic\PointSale\PointSale;

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

class DeliveryNoteRepository extends BaseService implements RepositoryInterface
{

}

+ 17
- 0
common/logic/Document/Invoice/InvoiceBuilder.php View File

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

namespace common\logic\Document\Invoice;

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

class InvoiceBuilder extends DocumentBuilder implements BuilderInterface
{
public function instanciate(): Invoice
{
$invoice = new Invoice();

return $invoice;
}
}

+ 9
- 7
common/logic/Document/Invoice/InvoiceContainer.php View File

@@ -5,6 +5,7 @@ namespace common\logic\Document\Invoice;
use common\logic\ContainerInterface;
use common\logic\Document\Document\DocumentBuilder;
use common\logic\Document\Document\DocumentSolver;
use common\logic\PointSale\PointSale\InvoiceRepository;

class InvoiceContainer implements ContainerInterface
{
@@ -16,22 +17,23 @@ class InvoiceContainer implements ContainerInterface
public function getServices(): array
{
return [
InvoiceFactory::class,
DocumentSolver::class,
InvoiceBuilder::class,
];
}

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

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

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

+ 0
- 16
common/logic/Document/Invoice/InvoiceFactory.php View File

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

namespace common\logic\Document\Invoice;

use common\logic\BaseService;
use common\logic\FactoryInterface;

class InvoiceFactory extends BaseService implements FactoryInterface
{
public function create(): Invoice
{
$invoice = new Invoice();

return $invoice;
}
}

+ 11
- 0
common/logic/Document/Invoice/InvoiceRepository.php View File

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

namespace common\logic\PointSale\PointSale;

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

class InvoiceRepository extends BaseService implements RepositoryInterface
{

}

common/logic/Document/Quotation/QuotationFactory.php → common/logic/Document/Quotation/QuotationBuilder.php View File

@@ -3,11 +3,11 @@
namespace common\logic\Document\Quotation;

use common\logic\BaseService;
use common\logic\FactoryInterface;
use common\logic\BuilderInterface;

class QuotationFactory extends BaseService implements FactoryInterface
class QuotationBuilder extends BaseService implements BuilderInterface
{
public function create(): Quotation
public function instanciate(): Quotation
{
$quotation = new Quotation();


+ 10
- 8
common/logic/Document/Quotation/QuotationContainer.php View File

@@ -5,8 +5,10 @@ namespace common\logic\Document\Invoice;
use common\logic\ContainerInterface;
use common\logic\Document\Document\DocumentBuilder;
use common\logic\Document\Document\DocumentSolver;
use common\logic\Document\Quotation\QuotationBuilder;
use common\logic\Document\Quotation\QuotationFactory;
use common\logic\Document\Quotation\Quotation;
use common\logic\PointSale\PointSale\QuotationRepository;

class QuotationContainer implements ContainerInterface
{
@@ -18,22 +20,22 @@ class QuotationContainer implements ContainerInterface
public function getServices(): array
{
return [
QuotationFactory::class,
QuotationBuilder::class,
];
}

public function getFactory(): QuotationFactory
{
return new QuotationFactory();
}

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

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

+ 11
- 0
common/logic/Document/Quotation/QuotationRepository.php View File

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

namespace common\logic\PointSale\PointSale;

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

class QuotationRepository extends BaseService implements RepositoryInterface
{

}

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

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

namespace common\logic;

interface FactoryInterface
{

}

+ 6
- 1
common/logic/Order/Order/OrderBuilder.php View File

@@ -8,5 +8,10 @@ use common\logic\SolverInterface;

class OrderBuilder extends BaseService implements BuilderInterface
{
public function instanciate(): Order
{
$order = new Order();

return $order;
}
}

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

@@ -14,7 +14,6 @@ class OrderContainer implements ContainerInterface
public function getServices(): array
{
return [
OrderFactory::class,
OrderSolver::class,
OrderRepository::class,
OrderBuilder::class,
@@ -22,11 +21,6 @@ class OrderContainer implements ContainerInterface
];
}

public function getFactory(): OrderFactory
{
return new OrderFactory();
}

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

+ 0
- 16
common/logic/Order/Order/OrderFactory.php View File

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

namespace common\logic\Order\Order;

use common\logic\BaseService;
use common\logic\FactoryInterface;

class OrderFactory extends BaseService implements FactoryInterface
{
public function create(): Order
{
$order = new Order();

return $order;
}
}

common/logic/Order/OrderStatusHistory/OrderStatusHistoryFactory.php → common/logic/Order/OrderStatusHistory/OrderStatusHistoryBuilder.php View File

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

use common\logic\BaseService;
use common\logic\FactoryInterface;
use common\logic\BuilderInterface;

class OrderStatusHistoryFactory extends BaseService implements FactoryInterface
class OrderStatusHistoryBuilder extends BaseService implements BuilderInterface
{
public function create(): OrderStatusHistory
public function instanciate(): OrderStatusHistory
{
$orderStatusHistory = new OrderStatusHistory();


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

@@ -3,6 +3,7 @@
namespace common\logic\Order\OrderStatusHistory;

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

class OrderStatusHistoryContainer implements ContainerInterface
{
@@ -14,12 +15,18 @@ class OrderStatusHistoryContainer implements ContainerInterface
public function getServices(): array
{
return [
OrderStatusHistoryFactory::class
OrderStatusHistoryRepository::class,
OrderStatusHistoryBuilder::class
];
}

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

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

+ 11
- 0
common/logic/Order/OrderStatusHistory/OrderStatusHistoryRepository.php View File

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

namespace common\logic\PointSale\PointSale;

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

class OrderStatusHistoryRepository extends BaseService implements RepositoryInterface
{

}

common/logic/Order/ProductOrder/ProductOrderFactory.php → common/logic/Order/ProductOrder/ProductOrderBuilder.php View File

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

use common\logic\BaseService;
use common\logic\FactoryInterface;
use common\logic\BuilderInterface;

class ProductOrderFactory extends BaseService implements FactoryInterface
class ProductOrderBuilder extends BaseService implements BuilderInterface
{
public function create(): ProductOrder
public function instanciate(): ProductOrder
{
$productOrder = new ProductOrder();


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

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

use common\logic\ContainerInterface;
use common\logic\PointSale\PointSale\ProductOrderRepository;

class ProductOrderContainer implements ContainerInterface
{
@@ -14,18 +15,24 @@ class ProductOrderContainer implements ContainerInterface
public function getServices(): array
{
return [
ProductOrderFactory::class,
ProductOrderSolver::class,
ProductOrderRepository::class,
ProductOrderBuilder::class,
];
}

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

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

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

+ 11
- 0
common/logic/Order/ProductOrder/ProductOrderRepository.php View File

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

namespace common\logic\PointSale\PointSale;

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

class ProductOrderRepository extends BaseService implements RepositoryInterface
{

}

+ 6
- 1
common/logic/PointSale/PointSale/PointSaleBuilder.php View File

@@ -8,5 +8,10 @@ use common\logic\SolverInterface;

class PointSaleBuilder extends BaseService implements BuilderInterface
{
public function instanciate(): PointSale
{
$pointSale = new PointSale();

return $pointSale;
}
}

+ 0
- 6
common/logic/PointSale/PointSale/PointSaleContainer.php View File

@@ -14,18 +14,12 @@ class PointSaleContainer implements ContainerInterface
public function getServices(): array
{
return [
PointSaleFactory::class,
PointSaleSolver::class,
PointSaleRepository::class,
PointSaleBuilder::class,
];
}

public function getFactory(): PointSaleFactory
{
return new PointSaleFactory();
}

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

+ 0
- 16
common/logic/PointSale/PointSale/PointSaleFactory.php View File

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

namespace common\logic\PointSale\PointSale;

use common\logic\BaseService;
use common\logic\FactoryInterface;

class PointSaleFactory extends BaseService implements FactoryInterface
{
public function create(): PointSale
{
$pointSale = new PointSale();

return $pointSale;
}
}

common/logic/PointSale/UserPointSale/UserPointSaleFactory.php → common/logic/PointSale/UserPointSale/UserPointSaleBuilder.php View File

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

use common\logic\BaseService;
use common\logic\FactoryInterface;
use common\logic\BuilderInterface;

class UserPointSaleFactory extends BaseService implements FactoryInterface
class UserPointSaleBuilder extends BaseService implements BuilderInterface
{
public function create(): UserPointSale
public function instanciate(): UserPointSale
{
$userPointSale = new UserPointSale();


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

@@ -3,6 +3,7 @@
namespace common\logic\PointSale\UserPointSale;

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

class UserPointSaleContainer implements ContainerInterface
{
@@ -14,12 +15,18 @@ class UserPointSaleContainer implements ContainerInterface
public function getServices(): array
{
return [
UserPointSaleFactory::class,
UserPointSaleRepository::class,
UserPointSaleBuilder::class,
];
}

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

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

+ 12
- 0
common/logic/PointSale/UserPointSale/UserPointSaleRepository.php View File

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

namespace common\logic\PointSale\PointSale;

use common\logic\BaseService;
use common\logic\BuilderInterface;
use common\logic\RepositoryInterface;

class UserPointSaleRepository extends BaseService implements RepositoryInterface
{

}

+ 10
- 0
common/logic/Producer/Producer/ProducerBuilder.php View File

@@ -26,6 +26,16 @@ class ProducerBuilder extends BaseService implements BuilderInterface
$this->producerSolver = $this->loadService(ProducerSolver::class);
}

public function instanciate(): Producer
{
$producer = new Producer();

$producer->order_deadline = Producer::ORDER_DEADLINE_DEFAULT;
$producer->order_delay = Producer::ORDER_DELAY_DEFAULT;

return $producer;
}

public function init(Producer $producer): void
{
$this->initSlug($producer);

+ 0
- 6
common/logic/Producer/Producer/ProducerContainer.php View File

@@ -14,7 +14,6 @@ class ProducerContainer implements ContainerInterface
public function getServices(): array
{
return [
ProducerFactory::class,
ProducerSolver::class,
ProducerRepository::class,
ProducerBuilder::class,
@@ -22,11 +21,6 @@ class ProducerContainer implements ContainerInterface
];
}

public function getFactory(): ProducerFactory
{
return new ProducerFactory();
}

public function getSolver(): ProducerSolver
{
return new ProducerSolver();

+ 0
- 19
common/logic/Producer/Producer/ProducerFactory.php View File

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

namespace common\logic\Producer\Producer;

use common\logic\BaseService;
use common\logic\FactoryInterface;

class ProducerFactory extends BaseService implements FactoryInterface
{
public function create()
{
$producer = new Producer();

$producer->order_deadline = Producer::ORDER_DEADLINE_DEFAULT;
$producer->order_delay = Producer::ORDER_DELAY_DEFAULT;

return $producer;
}
}

+ 6
- 1
common/logic/Product/Product/ProductBuilder.php View File

@@ -7,5 +7,10 @@ use common\logic\BuilderInterface;

class ProductBuilder extends BaseService implements BuilderInterface
{
public function instanciate(): Product
{
$product = new Product();

return $product;
}
}

+ 4
- 7
common/logic/Product/Product/ProductContainer.php View File

@@ -14,18 +14,12 @@ class ProductContainer implements ContainerInterface
public function getServices(): array
{
return [
ProductFactory::class,
ProductSolver::class,
ProductRepository::class,
ProductBuilder::class,
ProductRepository::class,
];
}

public function getFactory(): ProductFactory
{
return new ProductFactory();
}

public function getSolver(): ProductSolver
{
return new ProductSolver();
@@ -40,4 +34,7 @@ class ProductContainer implements ContainerInterface
{
return new ProductBuilder();
}



}

+ 0
- 16
common/logic/Product/Product/ProductFactory.php View File

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

namespace common\logic\Product\Product;

use common\logic\BaseService;
use common\logic\FactoryInterface;

class ProductFactory extends BaseService implements FactoryInterface
{
public function create(): Product
{
$product = new Product();

return $product;
}
}

common/logic/Product/ProductCategory/ProductCategoryFactory.php → common/logic/Product/ProductCategory/ProductCategoryBuilder.php View File

@@ -3,11 +3,11 @@
namespace common\logic\Product\ProductCategory;

use common\logic\BaseService;
use common\logic\FactoryInterface;
use common\logic\BuilderInterface;

class ProductCategoryFactory extends BaseService implements FactoryInterface
class ProductCategoryBuilder extends BaseService implements BuilderInterface
{
public function create(): ProductCategory
public function instanciate(): ProductCategory
{
$productCategory = new ProductCategory();


+ 3
- 3
common/logic/Product/ProductCategory/ProductCategoryContainer.php View File

@@ -14,14 +14,14 @@ class ProductCategoryContainer implements ContainerInterface
public function getServices(): array
{
return [
ProductCategoryFactory::class,
ProductCategoryBuilder::class,
ProductCategoryRepository::class
];
}

public function getFactory(): ProductCategoryFactory
public function getBuilder(): ProductCategoryBuilder
{
return new ProductCategoryFactory();
return new ProductCategoryBuilder();
}

public function getRepository(): ProductCategoryRepository

common/logic/Product/ProductPointSale/ProductPointSaleFactory.php → common/logic/Product/ProductPointSale/ProductPointSaleBuilder.php View File

@@ -3,11 +3,11 @@
namespace common\logic\Product\ProductPointSale;

use common\logic\BaseService;
use common\logic\FactoryInterface;
use common\logic\BuilderInterface;

class ProductPointSaleFactory extends BaseService implements FactoryInterface
class ProductPointSaleBuilder extends BaseService implements BuilderInterface
{
public function create(): ProductPointSale
public function instanciate(): ProductPointSale
{
$productPointSale = new ProductPointSale();


+ 10
- 3
common/logic/Product/ProductPointSale/ProductPointSaleContainer.php View File

@@ -3,6 +3,7 @@
namespace common\logic\Product\ProductPointSale;

use common\logic\ContainerInterface;
use common\logic\Product\ProductPrice\ProductPointSaleRepository;

class ProductPointSaleContainer implements ContainerInterface
{
@@ -14,12 +15,18 @@ class ProductPointSaleContainer implements ContainerInterface
public function getServices(): array
{
return [
ProductPointSaleFactory::class,
ProductPointSaleRepository::class,
ProductPointSaleBuilder::class,
];
}

public function getFactory(): ProductPointSaleFactory
public function getRepository(): ProductPointSaleRepository
{
return new ProductPointSaleFactory();
return new ProductPointSaleRepository();
}

public function getBuilder(): ProductPointSaleBuilder
{
return new ProductPointSaleBuilder();
}
}

+ 11
- 0
common/logic/Product/ProductPointSale/ProductPointSaleRepository.php View File

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

namespace common\logic\Product\ProductPrice;

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

class ProductPointSaleRepository extends BaseService implements RepositoryInterface
{

}

common/logic/Product/ProductPrice/ProductPriceFactory.php → common/logic/Product/ProductPrice/ProductPriceBuilder.php View File

@@ -3,11 +3,11 @@
namespace common\logic\Product\ProductPrice;

use common\logic\BaseService;
use common\logic\FactoryInterface;
use common\logic\BuilderInterface;

class ProductPriceFactory extends BaseService implements FactoryInterface
class ProductPriceBuilder extends BaseService implements BuilderInterface
{
public function create(): ProductPrice
public function instanciate(): ProductPrice
{
$productPrice = new ProductPrice();


+ 2
- 3
common/logic/Product/ProductPrice/ProductPriceContainer.php View File

@@ -14,15 +14,14 @@ class ProductPriceContainer implements ContainerInterface
public function getServices(): array
{
return [
ProductPriceFactory::class,
ProductPriceSolver::class,
ProductPriceRepository::class
];
}

public function getFactory(): ProductPriceFactory
public function getBuilder(): ProductPriceBuilder
{
return new ProductPriceFactory();
return new ProductPriceBuilder();
}

public function getSolver(): ProductPriceSolver

common/logic/Subscription/ProductSubscription/ProductSubscriptionFactory.php → common/logic/Subscription/ProductSubscription/ProductSubscriptionBuilder.php View File

@@ -3,11 +3,11 @@
namespace common\logic\Subscription\ProductSubscription;

use common\logic\BaseService;
use common\logic\FactoryInterface;
use common\logic\BuilderInterface;

class ProductSubscriptionFactory extends BaseService implements FactoryInterface
class ProductSubscriptionBuilder extends BaseService implements BuilderInterface
{
public function create(): ProductSubscription
public function instanciate(): ProductSubscription
{
$productSubscription = new ProductSubscription();


+ 3
- 3
common/logic/Subscription/ProductSubscription/ProductSubscriptionContainer.php View File

@@ -14,12 +14,12 @@ class ProductSubscriptionContainer implements ContainerInterface
public function getServices(): array
{
return [
ProductSubscriptionFactory::class
ProductSubscriptionBuilder::class
];
}

public function getFactory(): ProductSubscriptionFactory
public function getFactory(): ProductSubscriptionBuilder
{
return new ProductSubscriptionFactory();
return new ProductSubscriptionBuilder();
}
}

+ 5
- 0
common/logic/Subscription/Subscription/SubscriptionBuilder.php View File

@@ -7,5 +7,10 @@ use common\logic\BuilderInterface;

class SubscriptionBuilder extends BaseService implements BuilderInterface
{
public function instanciate(): Subscription
{
$subscription = new Subscription();

return $subscription;
}
}

+ 0
- 6
common/logic/Subscription/Subscription/SubscriptionContainer.php View File

@@ -14,18 +14,12 @@ class SubscriptionContainer implements ContainerInterface
public function getServices(): array
{
return [
SubscriptionFactory::class,
SubscriptionSolver::class,
SubscriptionRepository::class,
SubscriptionBuilder::class
];
}

public function getFactory(): SubscriptionFactory
{
return new SubscriptionFactory();
}

public function getSolver(): SubscriptionSolver
{
return new SubscriptionSolver();

+ 0
- 16
common/logic/Subscription/Subscription/SubscriptionFactory.php View File

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

namespace common\logic\Subscription\Subscription;

use common\logic\BaseService;
use common\logic\FactoryInterface;

class SubscriptionFactory extends BaseService implements FactoryInterface
{
public function create(): Subscription
{
$subscription = new Subscription();

return $subscription;
}
}

+ 7
- 0
common/logic/User/CreditHistory/CreditHistoryBuilder.php View File

@@ -17,6 +17,13 @@ class CreditHistoryBuilder extends BaseService implements BuilderInterface
$this->userProducerBuilder = $this->loadService(UserProducerBuilder::class);
}

public function instanciate(): CreditHistory
{
$creditHistory = new CreditHistory();

return $creditHistory;
}

public function save(CreditHistory $creditHistory): bool
{
if ($creditHistory->getAmount() > -0.01 && $creditHistory->getAmount() < 0.01) {

+ 0
- 6
common/logic/User/CreditHistory/CreditHistoryContainer.php View File

@@ -14,18 +14,12 @@ class CreditHistoryContainer implements ContainerInterface
public function getServices(): array
{
return [
CreditHistoryFactory::class,
CreditHistorySolver::class,
CreditHistoryBuilder::class,
CreditHistoryRepository::class,
];
}

public function getFactory(): CreditHistoryFactory
{
return new CreditHistoryFactory();
}

public function getSolver(): CreditHistorySolver
{
return new CreditHistorySolver();

+ 0
- 15
common/logic/User/CreditHistory/CreditHistoryFactory.php View File

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

namespace common\logic\User\CreditHistory;

use common\logic\FactoryInterface;

class CreditHistoryFactory implements FactoryInterface
{
public function create()
{
$creditHistory = new CreditHistory();

return $creditHistory;
}
}

+ 7
- 0
common/logic/User/User/UserBuilder.php View File

@@ -8,6 +8,13 @@ use common\logic\Producer\Producer\Producer;

class UserBuilder extends BaseService implements BuilderInterface
{
public function instanciate(): User
{
$user = new User();

return $user;
}

public function initPassword(User $user, string $password)
{
$user->setPassword($password);

+ 0
- 6
common/logic/User/User/UserContainer.php View File

@@ -14,7 +14,6 @@ class UserContainer implements ContainerInterface
public function getServices(): array
{
return [
UserFactory::class,
UserSolver::class,
UserRepository::class,
UserBuilder::class,
@@ -22,11 +21,6 @@ class UserContainer implements ContainerInterface
];
}

public function getFactory(): UserFactory
{
return new UserFactory();
}

public function getSolver(): UserSolver
{
return new UserSolver();

+ 0
- 16
common/logic/User/User/UserFactory.php View File

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

namespace common\logic\User\User;

use common\logic\BaseService;
use common\logic\FactoryInterface;

class UserFactory extends BaseService implements FactoryInterface
{
public function create()
{
$user = new User();

return $user;
}
}

common/logic/User/UserGroup/UserGroupFactory.php → common/logic/User/UserGroup/UserGroupBuilder.php View File

@@ -3,11 +3,11 @@
namespace common\logic\User\UserGroup;

use common\logic\BaseService;
use common\logic\FactoryInterface;
use common\logic\BuilderInterface;

class UserGroupFactory extends BaseService implements FactoryInterface
class UserGroupBuilder extends BaseService implements BuilderInterface
{
public function create()
public function instanciate(): UserGroup
{
$userGroup = new UserGroup();


+ 3
- 3
common/logic/User/UserGroup/UserGroupContainer.php View File

@@ -14,14 +14,14 @@ class UserGroupContainer implements ContainerInterface
public function getServices(): array
{
return [
UserGroupFactory::class,
UserGroupBuilder::class,
UserGroupRepository::class
];
}

public function getFactory(): UserGroupFactory
public function getFactory(): UserGroupBuilder
{
return new UserGroupFactory();
return new UserGroupBuilder();
}

public function getRepository(): UserGroupRepository

+ 13
- 0
common/logic/User/UserProducer/UserProducerBuilder.php View File

@@ -21,6 +21,19 @@ class UserProducerBuilder extends BaseService implements BuilderInterface
$this->userProducerRepository = $this->loadService(UserProducerRepository::class);
}

public function instanciate(int $idUser, int $idProducer, int $bookmark = 1)
{
$userProducer = new UserProducer();

$userProducer->setIdUser($idUser);
$userProducer->setIdProducer($idProducer);
$userProducer->setCredit(0);
$userProducer->setActive(1);
$userProducer->setBookmark($bookmark);

return $userProducer;
}

public function updateCredit(CreditHistory $creditHistory): void
{
$userProducer = $this->userProducerRepository->getOne($creditHistory->getIdUser(), $creditHistory->getIdProducer());

+ 7
- 1
common/logic/User/UserProducer/UserProducerContainer.php View File

@@ -14,7 +14,8 @@ class UserProducerContainer implements ContainerInterface
public function getServices(): array
{
return [
UserProducerRepository::class
UserProducerRepository::class,
UserProducerBuilder::class,
];
}

@@ -22,4 +23,9 @@ class UserProducerContainer implements ContainerInterface
{
return new UserProducerRepository();
}

public function getBuilder(): UserProducerBuilder
{
return new UserProducerBuilder();
}
}

+ 0
- 21
common/logic/User/UserProducer/UserProducerFactory.php View File

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

namespace common\logic\User\UserProducer;

use common\logic\FactoryInterface;

class UserProducerFactory implements FactoryInterface
{
public function create(int $idUser, int $idProducer, int $bookmark = 1)
{
$userProducer = new UserProducer();

$userProducer->setIdUser($idUser);
$userProducer->setIdProducer($idProducer);
$userProducer->setCredit(0);
$userProducer->setActive(1);
$userProducer->setBookmark($bookmark);

return $userProducer;
}
}

+ 16
- 0
common/logic/User/UserUserGroup/UserUserGroupBuilder.php View File

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

namespace common\logic\User\UserGroup;

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

class UserUserGroupBuilder extends BaseService implements BuilderInterface
{
public function instanciate(): UserUserGroup
{
$userUserGroup = new UserUserGroup();

return $userUserGroup;
}
}

+ 11
- 4
common/logic/User/UserUserGroup/UserUserGroupContainer.php View File

@@ -3,23 +3,30 @@
namespace common\logic\User\UserGroup;

use common\logic\ContainerInterface;
use common\logic\User\UserProducer\UserUserGroupRepository;

class UserUserGroupContainer implements ContainerInterface
{
public function getEntityFqcn(): string
{
return User UserGroup::class;
return UserUserGroup::class;
}

public function getServices(): array
{
return [
UserUserGroupFactory::class
UserUserGroupRepository::class,
UserUserGroupBuilder::class
];
}

public function getFactory(): UserUserGroupFactory
public function getRepository(): UserUserGroupRepository
{
return new UserUserGroupFactory();
return new UserUserGroupRepository();
}

public function getBuilder(): UserUserGroupBuilder
{
return new UserUserGroupBuilder();
}
}

+ 0
- 16
common/logic/User/UserUserGroup/UserUserGroupFactory.php View File

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

namespace common\logic\User\UserGroup;

use common\logic\BaseService;
use common\logic\FactoryInterface;

class UserUserGroupFactory extends BaseService implements FactoryInterface
{
public function create(): User UserGroup
{
$userUserGroup = new User UserGroup();

return $userUserGroup;
}
}

+ 11
- 0
common/logic/User/UserUserGroup/UserUserGroupRepository.php View File

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

namespace common\logic\User\UserProducer;

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

class UserUserGroupRepository extends BaseService implements RepositoryInterface
{

}

Loading…
Cancel
Save