Browse Source

Merge branch 'develop' of https://forge.laclic.fr/Laclic/CaracoleBundle into develop

packProduct
Charly 3 years ago
parent
commit
f1e3f96a7c
5 changed files with 34 additions and 2 deletions
  1. +9
    -0
      Builder/Product/ProductFamilyBuilder.php
  2. +9
    -1
      Container/PointSale/PointSaleContainer.php
  3. +10
    -1
      Container/Product/ProductFamilyContainer.php
  4. +1
    -0
      Solver/Price/ProductPriceSolver.php
  5. +5
    -0
      Solver/Product/ProductFamilySolver.php

+ 9
- 0
Builder/Product/ProductFamilyBuilder.php View File

<?php

namespace Lc\CaracoleBundle\Builder\Product;


class ProductFamilyBuilder
{

}

+ 9
- 1
Container/PointSale/PointSaleContainer.php View File

use Lc\CaracoleBundle\Factory\PointSale\PointSaleFactory; use Lc\CaracoleBundle\Factory\PointSale\PointSaleFactory;
use Lc\CaracoleBundle\Repository\PointSale\PointSaleRepositoryQuery; use Lc\CaracoleBundle\Repository\PointSale\PointSaleRepositoryQuery;
use Lc\CaracoleBundle\Repository\PointSale\PointSaleStore; use Lc\CaracoleBundle\Repository\PointSale\PointSaleStore;
use Lc\CaracoleBundle\Solver\PointSale\PointSaleSolver;


class PointSaleContainer class PointSaleContainer
{ {
protected PointSaleFactory $factory; protected PointSaleFactory $factory;
protected PointSaleSolver $solver;
protected PointSaleRepositoryQuery $repositoryQuery; protected PointSaleRepositoryQuery $repositoryQuery;
protected PointSaleStore $store; protected PointSaleStore $store;


public function __construct( public function __construct(
PointSaleFactory $factory, PointSaleFactory $factory,
PointSaleSolver $solver,
PointSaleRepositoryQuery $repositoryQuery, PointSaleRepositoryQuery $repositoryQuery,
PointSaleStore $store PointSaleStore $store
) { ) {
$this->factory = $factory; $this->factory = $factory;
$this->solver = $solver;
$this->repositoryQuery = $repositoryQuery; $this->repositoryQuery = $repositoryQuery;
$this->store = $store; $this->store = $store;
} }
return $this->factory; return $this->factory;
} }


public function getSolver(): PointSaleSolver
{
return $this->solver;
}

public function getRepositoryQuery(): PointSaleRepositoryQuery public function getRepositoryQuery(): PointSaleRepositoryQuery
{ {
return $this->repositoryQuery; return $this->repositoryQuery;
{ {
return $this->store; return $this->store;
} }

} }

+ 10
- 1
Container/Product/ProductFamilyContainer.php View File



namespace Lc\CaracoleBundle\Container\Product; namespace Lc\CaracoleBundle\Container\Product;


use Lc\CaracoleBundle\Builder\Product\ProductFamilyBuilder;
use Lc\CaracoleBundle\Factory\Product\ProductFamilyFactory; use Lc\CaracoleBundle\Factory\Product\ProductFamilyFactory;
use Lc\CaracoleBundle\Repository\Product\ProductFamilyRepositoryQuery; use Lc\CaracoleBundle\Repository\Product\ProductFamilyRepositoryQuery;
use Lc\CaracoleBundle\Repository\Product\ProductFamilyStore; use Lc\CaracoleBundle\Repository\Product\ProductFamilyStore;
protected ProductFamilySolver $solver; protected ProductFamilySolver $solver;
protected ProductFamilyRepositoryQuery $repositoryQuery; protected ProductFamilyRepositoryQuery $repositoryQuery;
protected ProductFamilyStore $store; protected ProductFamilyStore $store;
protected ProductFamilyBuilder $builder;
protected ProductFamilyResolver $resolver; protected ProductFamilyResolver $resolver;


public function __construct( public function __construct(
ProductFamilySolver $solver, ProductFamilySolver $solver,
ProductFamilyRepositoryQuery $repositoryQuery, ProductFamilyRepositoryQuery $repositoryQuery,
ProductFamilyStore $store, ProductFamilyStore $store,
ProductFamilyBuilder $builder,
ProductFamilyResolver $resolver ProductFamilyResolver $resolver
) { ) {
$this->factory = $factory; $this->factory = $factory;
$this->solver = $solver; $this->solver = $solver;
$this->repositoryQuery = $repositoryQuery; $this->repositoryQuery = $repositoryQuery;
$this->store = $store; $this->store = $store;
$this->builder = $builder;
$this->resolver = $resolver; $this->resolver = $resolver;
} }


return $this->resolver; return $this->resolver;
} }


}
public function getBuilder(): ProductFamilyBuilder
{
return $this->builder;
}

}

+ 1
- 0
Solver/Price/ProductPriceSolver.php View File

$solver = $this->getSolver($product); $solver = $this->getSolver($product);


if ($solver->getBehaviorPriceInherited($product) == 'by-piece') { if ($solver->getBehaviorPriceInherited($product) == 'by-piece') {
dump($product);
return $solver->getBuyingPriceInherited($product); return $solver->getBuyingPriceInherited($product);
} elseif ($solver->getBehaviorPriceInherited($product) == 'by-reference-unit') { } elseif ($solver->getBehaviorPriceInherited($product) == 'by-reference-unit') {
if ($solver->getQuantityInherited($product) > 0) { if ($solver->getQuantityInherited($product) > 0) {

+ 5
- 0
Solver/Product/ProductFamilySolver.php View File

return $productFamily->getBuyingPriceByRefUnit(); return $productFamily->getBuyingPriceByRefUnit();
} }


public function getBuyingPriceInherited(ProductFamilyInterface $productFamily): ?float
{
return $productFamily->getBuyingPrice();
}

public function getPriceByRefUnitInherited(ProductFamilyInterface $productFamily): ?float public function getPriceByRefUnitInherited(ProductFamilyInterface $productFamily): ?float
{ {
return $productFamily->getPriceByRefUnit(); return $productFamily->getPriceByRefUnit();

Loading…
Cancel
Save