getServiceLocator()->get(PersistenceManager::SERVICE_ID); return $persistenceManager->getPersistenceById($this->getPersistenceId()); } /** * Apply all migrations * * @return \common_report_Report */ public function migrate() { $migrations = new Migrations(); $migrations->setServiceLocator($this->getServiceLocator()); return $migrations(['-c', 'migrate']); } /** * Skip extension migrations after installation * common_ext_event_ExtensionInstalled event callback * * @param ExtensionInstalled $event */ public function extensionInstalled(ExtensionInstalled $event) { $migrations = new Migrations(); $migrations->setServiceLocator($this->getServiceLocator()); if ($event->getExtension()->getId() === 'tao') { //supposedly application initial install and generis just have been installed. $migrations->__invoke(['-c', 'init']); $migrations->__invoke(['-c', 'add', '-e', 'generis']); } $migrations->__invoke(['-c', 'add', '-e', $event->getExtension()->getId()]); } /** * @return string */ private function getPersistenceId() { return $this->hasOption(self::OPTION_PERSISTENCE_ID) ? $this->getOption(self::OPTION_PERSISTENCE_ID) : self::DEFAULT_PERSISTENCE_ID; } }