Exemplo n.º 1
0
 /**
  * @param string $model
  * @param string|Rsc_Mvc_Module $module
  */
 public function factory($model, $module = null)
 {
     $className = $this->getClassName($model, $module);
     if (!class_exists($className) && $this->environment->isPro()) {
         $className = $this->getClassName($model, $module, $this->environment->getConfig()->get('pro_modules_prefix'));
     }
     if (!class_exists($className)) {
         throw new InvalidArgumentException(sprintf('Cant find class for model %s', $model));
     }
     $class = new $className();
     if ($class instanceof Rsc_Environment_AwareInterface) {
         $class->setEnvironment($this->environment);
     }
     if (method_exists($class, 'onInstanceReady')) {
         $class->onInstanceReady();
     }
     return $class;
 }