@@ -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 ' |
@@ -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(); | |||
} | |||
} |
@@ -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()); | |||
} | |||
} |
@@ -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 |
@@ -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']) |
@@ -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); | |||