@@ -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); |
@@ -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(); | |||
@@ -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 |
@@ -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; |
@@ -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(); | |||
@@ -0,0 +1,11 @@ | |||
<?php | |||
namespace common\logic\PointSale\PointSale; | |||
use common\logic\BaseService; | |||
use common\logic\RepositoryInterface; | |||
class DeliveryNoteRepository extends BaseService implements RepositoryInterface | |||
{ | |||
} |
@@ -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; | |||
} | |||
} |
@@ -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(); | |||
} | |||
} |
@@ -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; | |||
} | |||
} |
@@ -0,0 +1,11 @@ | |||
<?php | |||
namespace common\logic\PointSale\PointSale; | |||
use common\logic\BaseService; | |||
use common\logic\RepositoryInterface; | |||
class InvoiceRepository extends BaseService implements RepositoryInterface | |||
{ | |||
} |
@@ -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(); | |||
@@ -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(); | |||
} | |||
} |
@@ -0,0 +1,11 @@ | |||
<?php | |||
namespace common\logic\PointSale\PointSale; | |||
use common\logic\BaseService; | |||
use common\logic\RepositoryInterface; | |||
class QuotationRepository extends BaseService implements RepositoryInterface | |||
{ | |||
} |
@@ -1,8 +0,0 @@ | |||
<?php | |||
namespace common\logic; | |||
interface FactoryInterface | |||
{ | |||
} |
@@ -8,5 +8,10 @@ use common\logic\SolverInterface; | |||
class OrderBuilder extends BaseService implements BuilderInterface | |||
{ | |||
public function instanciate(): Order | |||
{ | |||
$order = new Order(); | |||
return $order; | |||
} | |||
} |
@@ -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(); |
@@ -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; | |||
} | |||
} |
@@ -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(); | |||
@@ -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(); | |||
} | |||
} |
@@ -0,0 +1,11 @@ | |||
<?php | |||
namespace common\logic\PointSale\PointSale; | |||
use common\logic\BaseService; | |||
use common\logic\RepositoryInterface; | |||
class OrderStatusHistoryRepository extends BaseService implements RepositoryInterface | |||
{ | |||
} |
@@ -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(); | |||
@@ -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(); | |||
} | |||
} |
@@ -0,0 +1,11 @@ | |||
<?php | |||
namespace common\logic\PointSale\PointSale; | |||
use common\logic\BaseService; | |||
use common\logic\RepositoryInterface; | |||
class ProductOrderRepository extends BaseService implements RepositoryInterface | |||
{ | |||
} |
@@ -8,5 +8,10 @@ use common\logic\SolverInterface; | |||
class PointSaleBuilder extends BaseService implements BuilderInterface | |||
{ | |||
public function instanciate(): PointSale | |||
{ | |||
$pointSale = new PointSale(); | |||
return $pointSale; | |||
} | |||
} |
@@ -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(); |
@@ -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; | |||
} | |||
} |
@@ -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(); | |||
@@ -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(); | |||
} | |||
} |
@@ -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 | |||
{ | |||
} |
@@ -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); |
@@ -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(); |
@@ -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; | |||
} | |||
} |
@@ -7,5 +7,10 @@ use common\logic\BuilderInterface; | |||
class ProductBuilder extends BaseService implements BuilderInterface | |||
{ | |||
public function instanciate(): Product | |||
{ | |||
$product = new Product(); | |||
return $product; | |||
} | |||
} |
@@ -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(); | |||
} | |||
} |
@@ -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; | |||
} | |||
} |
@@ -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(); | |||
@@ -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 |
@@ -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(); | |||
@@ -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(); | |||
} | |||
} |
@@ -0,0 +1,11 @@ | |||
<?php | |||
namespace common\logic\Product\ProductPrice; | |||
use common\logic\BaseService; | |||
use common\logic\RepositoryInterface; | |||
class ProductPointSaleRepository extends BaseService implements RepositoryInterface | |||
{ | |||
} |
@@ -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(); | |||
@@ -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 |
@@ -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(); | |||
@@ -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(); | |||
} | |||
} |
@@ -7,5 +7,10 @@ use common\logic\BuilderInterface; | |||
class SubscriptionBuilder extends BaseService implements BuilderInterface | |||
{ | |||
public function instanciate(): Subscription | |||
{ | |||
$subscription = new Subscription(); | |||
return $subscription; | |||
} | |||
} |
@@ -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(); |
@@ -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; | |||
} | |||
} |
@@ -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) { |
@@ -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(); |
@@ -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; | |||
} | |||
} |
@@ -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); |
@@ -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(); |
@@ -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; | |||
} | |||
} |
@@ -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(); | |||
@@ -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 |
@@ -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()); |
@@ -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(); | |||
} | |||
} |
@@ -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; | |||
} | |||
} |
@@ -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; | |||
} | |||
} |
@@ -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(); | |||
} | |||
} |
@@ -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; | |||
} | |||
} |
@@ -0,0 +1,11 @@ | |||
<?php | |||
namespace common\logic\User\UserProducer; | |||
use common\logic\BaseService; | |||
use common\logic\RepositoryInterface; | |||
class UserUserGroupRepository extends BaseService implements RepositoryInterface | |||
{ | |||
} |