Explorar el Código

Refactoring services #885

refactoring
Guillaume hace 1 año
padre
commit
d20d6dd42d
Se han modificado 6 ficheros con 7 adiciones y 7 borrados
  1. +1
    -1
      common/components/ActiveRecordCommon.php
  2. +2
    -2
      common/helpers/GlobalParam.php
  3. +1
    -1
      common/logic/AbstractManager.php
  4. +1
    -1
      common/logic/AbstractService.php
  5. +1
    -1
      common/logic/Document/Document/Document.php
  6. +1
    -1
      common/logic/Product/Product/Product.php

+ 1
- 1
common/components/ActiveRecordCommon.php Ver fichero

@@ -68,7 +68,7 @@ class ActiveRecordCommon extends \yii\db\ActiveRecord
$repositoryClass = $class.'Repository';

if (is_callable([$repositoryClass, 'getDefaultOptionsSearch'])) {
$repository = new $repositoryClass;
$repository = $repositoryClass::getInstance();
$default_options = $repository->getDefaultOptionsSearch();
} else {
throw new \ErrorException('La méthode "getDefaultOptionsSearch" n\'est '

+ 2
- 2
common/helpers/GlobalParam.php Ver fichero

@@ -86,13 +86,13 @@ class GlobalParam

public static function getCurrentUser()
{
$userSolver = new UserSolver();
$userSolver = UserSolver::getInstance();
return $userSolver->getCurrent();
}

public static function getCurrentUserId()
{
$userSolver = new UserSolver();
$userSolver = UserSolver::getInstance();
return $userSolver->getCurrentId();
}
}

+ 1
- 1
common/logic/AbstractManager.php Ver fichero

@@ -35,6 +35,6 @@ abstract class AbstractManager extends AbstractSingleton implements ManagerInter
public function initContainer(): void
{
$containerFqcn = $this->getContainerFqcn();
$this->setContainer(new $containerFqcn);
$this->setContainer($containerFqcn::getInstance());
}
}

+ 1
- 1
common/logic/AbstractService.php Ver fichero

@@ -24,7 +24,7 @@ abstract class AbstractService extends AbstractSingleton implements ServiceInter
throw new ErrorException('Le service '.$serviceClass.' ne peut pas être chargé ici.');
}

return new $serviceClass;
return $serviceClass::getInstance();
}

protected function loadDependencies(): void

+ 1
- 1
common/logic/Document/Document/Document.php Ver fichero

@@ -123,7 +123,7 @@ class Document extends ActiveRecordCommon implements DocumentInterface

public function relationOrders($fieldIdDocument)
{
$orderRepository = new OrderRepository();
$orderRepository = OrderRepository::getInstance();
$getDefaultOptionsSearch = $orderRepository->getDefaultOptionsSearch();

return $this->hasMany(Order::class, [$fieldIdDocument => 'id'])

+ 1
- 1
common/logic/Product/Product/Product.php Ver fichero

@@ -186,7 +186,7 @@ class Product extends ActiveRecordCommon
}
}

$productSolver = new ProductSolver();
$productSolver = ProductSolver::getInstance();
$this->wording_unit = $productSolver->strUnit($this->unit);
$this->price_with_tax = $productSolver->getPriceWithTax($this);


Cargando…
Cancelar
Guardar