public function load($packageName) {
		if ($this->loadedModules->has($packageName)) {
			return $this->loadedModules->get($packageName);
		}

		// check existence
		if (!$this->installedModules->has($packageName)) {
			throw new ModuleException(sprintf('Module (%s) does not exist.', $packageName), 500);
		}

		// check activation
		if (!$this->activatedModules->has($packageName)) {
			throw new ModuleException(sprintf('Module (%s) not activated', $packageName), 501);
		}

		$model = $this->activatedModules->get($packageName);

		if ($model->getInstalledVersion() > $model->getActivatedVersion()) {
			throw new ModuleException(sprintf('Module Version Mismatch (%s). Module needs to be updated by the Administrator', $packageName), 500);
		}

		// load
		$className = $model->getClassName();

		/* @var $module AbstractModule */
		$module = new $className($model, $this->service);
		$this->loadedModules->set($packageName, $module);

		// load locale
		$localeService = $this->getServiceContainer()->getLocaleService();
		$file = sprintf('/%s/locales/{locale}/translations.json', $packageName);
		$localeService->loadLocaleFile($file, $module->getCanonicalName());

		return $module;
	}
public function load($packageName) {
		if ($this->loadedModules->has($packageName)) {
			return $this->loadedModules->get($packageName);
		}

		// check existence
		if (!$this->installedModules->has($packageName)) {
			throw new ModuleException(sprintf('Module (%s) does not exist.', $packageName), 500);
		}

		// check activation
		if (!$this->activatedModules->has($packageName)) {
			throw new ModuleException(sprintf('Module (%s) not activated', $packageName), 501);
		}

		$model = $this->activatedModules->get($packageName);

		if ($model->getInstalledVersion() > $model->getActivatedVersion()) {
			throw new ModuleException(sprintf('Module Version Mismatch (%s). Module needs to be updated by the Administrator', $packageName), 500);
		}

		// load
		$className = $model->getClassName();

		/* @var $module AbstractModule */
		$module = new $className($model, $this->service);
		$this->loadedModules->set($packageName, $module);

		// load locale
		$localeService = $this->getServiceContainer()->getLocaleService();
		$file = sprintf('/%s/locales/{locale}/translations.json', $packageName);
		$localeService->loadLocaleFile($file, $module->getCanonicalName());

		return $module;
	}
public function load ( $ packageName ) { if ( $ this -> loadedModules -> has ( $ packageName ) ) { return $ this -> loadedModules -> get ( $ packageName ) ; } // check existence if ( ! $ this -> installedModules -> has ( $ packageName ) ) { throw new ModuleException ( sprintf ( 'Module (%s) does not exist.' , $ packageName ) , 500 ) ; } // check activation if ( ! $ this -> activatedModules -> has ( $ packageName ) ) { throw new ModuleException ( sprintf ( 'Module (%s) not activated' , $ packageName ) , 501 ) ; } $ model = $ this -> activatedModules -> get ( $ packageName ) ; if ( $ model -> getInstalledVersion ( ) > $ model -> getActivatedVersion ( ) ) { throw new ModuleException ( sprintf ( 'Module Version Mismatch (%s). Module needs to be updated by the Administrator' , $ packageName ) , 500 ) ; } // load $ className = $ model -> getClassName ( ) ; /* @var $module AbstractModule */ $ module = new $ className ( $ model , $ this -> service ) ; $ this -> loadedModules -> set ( $ packageName , $ module ) ; // load locale $ localeService = $ this -> getServiceContainer ( ) -> getLocaleService ( ) ; $ file = sprintf ( '/%s/locales/{locale}/translations.json' , $ packageName ) ; $ localeService -> loadLocaleFile ( $ file , $ module -> getCanonicalName ( ) ) ; return $ module ; }
Loads a module and returns the associated class or returns if already loaded

@param String $packageName
@throws ModuleException
@return AbstractModule
Loads a module and returns the associated class or returns if already loaded