Пример #1
0
 /**
  * Obtains a new instance of $modelClassName, using a dependency injection
  * container if possible.
  *
  * @param string $modelClassName name of the model
  *
  * @return object
  */
 public function factory($modelClassName)
 {
     if ($this->dependencyInjector) {
         return $this->dependencyInjector->getInstance($modelClassName);
     }
     $model = new $modelClassName();
     return $model;
 }
Пример #2
0
 /**
  * Obtains a new instance of $modelClassName, using a dependency injection
  * container if possible.
  *
  * @param string $modelClassName name of the model
  *
  * @return object
  */
 public static function factory($modelClassName)
 {
     if (self::$dependencyInjector) {
         return self::$dependencyInjector->getInstance($modelClassName);
     }
     return new $modelClassName();
 }