Browse Source

Refactoring services #885

refactoring
Guillaume 1 year ago
parent
commit
d20d6dd42d
6 changed files with 7 additions and 7 deletions
  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 View File

@@ -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 View File

@@ -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 View File

@@ -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 View File

@@ -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 View File

@@ -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 View File

@@ -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);


Loading…
Cancel
Save