ソースを参照

Refactoring services #885

refactoring
Guillaume 1年前
コミット
d20d6dd42d
6個のファイルの変更7行の追加7行の削除
  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 ファイルの表示

@@ -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 ファイルの表示

@@ -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 ファイルの表示

@@ -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 ファイルの表示

@@ -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 ファイルの表示

@@ -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 ファイルの表示

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


読み込み中…
キャンセル
保存