MODULE_VERSION = $arModuleVersion["VERSION"]; $this->MODULE_VERSION_DATE = $arModuleVersion["VERSION_DATE"]; $this->MODULE_NAME = Loc::getMessage("JINOVE_VINOTECA_MODULE_NAME"); $this->MODULE_DESCRIPTION = Loc::getMessage("JINOVE_VINOTECA_MODULE_DESCRIPTION"); $this->PARTNER_NAME = Loc::getMessage("JINOVE_VINOTECA_PARTNER_NAME"); $this->PARTNER_URI = "https://vinoteca.jimagie.com"; } public function DoInstall(): void { ModuleManager::registerModule($this->MODULE_ID); $this->InstallDB(); } public function DoUninstall(): void { $this->UnInstallDB(); ModuleManager::unRegisterModule($this->MODULE_ID); } public function InstallDB(): bool { Loader::includeModule($this->MODULE_ID); $connection = Application::getConnection(); $table = FavoriteTable::getTableName(); if (!$connection->isTableExists($table)) { FavoriteTable::getEntity()->createDbTable(); $connection->createIndex($table, "ux_" . $table, ["FUSER_ID", "PRODUCT_ID"], null, $connection::INDEX_UNIQUE); } return true; } public function UnInstallDB(): bool { Loader::includeModule($this->MODULE_ID); $connection = Application::getConnection(); $table = FavoriteTable::getTableName(); if ($connection->isTableExists($table)) { $connection->dropTable($table); } return true; } }