public function install() { $tableManager = new TableManager($this->emailDbAdapter); $tableConfig = $this->getTableConfig(); $tableName = Email::TABLE_NAME; $tableManager->createTable($tableName, $tableConfig); }
/** * {@inherit} * * {@inherit} */ public function __invoke(ContainerInterface $container, $requestedName, array $options = null) { $this->db = $container->has('db') ? $container->get('db') : null; if (is_null($this->db)) { throw new DataStoreException('Can\'t create Zend\\Db\\TableGateway\\TableGateway for ' . self::TABLE_NAME); } $tableManager = new TableManagerMysql($this->db, $this->tableConfig); // $hasTable = $tableManager->hasTable(self::TABLE_NAME); // if (!$hasTable) { if (!$tableManager->hasTable(self::TABLE_NAME)) { $tableManager->createTable(self::TABLE_NAME, self::TABLE_NAME); } $tableGateway = new TableGateway(self::TABLE_NAME, $this->db); $this->dataStore = new DbTable($tableGateway); // // Fill table using DbTable DataStore interface // if (!$hasTable) { // $this->fillTable($container); // } return $this->dataStore; }
public function install() { if (getenv('APP_ENV') === 'dev') { //develop only $tablesConfigDevelop = [TableManager::KEY_TABLES_CONFIGS => array_merge(SysEntities::getTableConfigProdaction(), StoreCatalog::$develop_tables_config)]; $tableManager = new TableManager($this->dbAdapter, $tablesConfigDevelop); $tableManager->rewriteTable(SysEntities::TABLE_NAME); $tableManager->rewriteTable(StoreCatalog::PRODUCT_TABLE_NAME); $tableManager->rewriteTable(StoreCatalog::TAG_TABLE_NAME); $tableManager->rewriteTable(StoreCatalog::MAINICON_TABLE_NAME); $tableManager->rewriteTable(StoreCatalog::MAIN_SPECIFIC_TABLE_NAME); $tableManager->rewriteTable(StoreCatalog::CATEGORY_TABLE_NAME); $tableManager->rewriteTable(StoreCatalog::PROP_LINKED_URL_TABLE_NAME); $tableManager->rewriteTable(StoreCatalog::PROP_PRODUCT_CATEGORY_TABLE_NAME); $tableManager->rewriteTable(StoreCatalog::PROP_TAG_TABLE_NAME); } else { $tablesConfigProdaction = [TableManager::KEY_TABLES_CONFIGS => SysEntities::getTableConfigProdaction()]; $tableManager = new TableManager($this->dbAdapter, $tablesConfigProdaction); $tableManager->createTable(SysEntities::TABLE_NAME); } }