/** * Install and activate a module * * @param Module $module */ public function install(Module $module) { $this->authorize($module, 'install'); // Only a not installed module can be installed if (self::STATE_NOT_INSTALLED !== $module->getState()) { throw new Exception\ModuleStateInvalidException(sprintf($this->getTranslator()->translate('Module "%s" is marked as "%s" and cannot be installed'), $module->getId(), $module->getState())); } // Invoke the module's install method $this->getModuleObject($module)->install($this->getServiceLocator()); // Persist the module entity $entity = new ModuleEntity(); $entity->setId($module->getId()); $entity->setIsActive(true); $entity->setVersion($module->getIni('version')); $this->getEntityManager()->persist($entity); $this->getEntityManager()->flush(); $module->setState(self::STATE_ACTIVE); }
/** * {@inheritDoc} */ public function setVersion($version) { $this->__initializer__ && $this->__initializer__->__invoke($this, 'setVersion', array($version)); return parent::setVersion($version); }