|
123456789101112131415161718192021222324252627 |
- <?php
-
- namespace common\logic;
-
- use yii\base\ErrorException;
-
- abstract class AbstractModule extends AbstractSingleton implements ModuleInterface
- {
- public function getEntityFqcn(): string
- {
- return $this->getDefinition()->getEntityFqcn();
- }
-
- public function __call($method, $args)
- {
- foreach($this->getServices() as $serviceClass) {
- if(method_exists($serviceClass, $method)) {
- return call_user_func_array(
- [$serviceClass::getInstance(), $method],
- $args
- );
- }
- }
-
- throw new ErrorException('La méthode '.$method.' est introuvable dans les services du module '.get_class($this));
- }
- }
|