schemaSetup = $schemaSetup; $this->defaultCategoryFactory = $defaultCategoryFactory; } /** * {@inheritdoc} */ public function apply() { $this->schemaSetup->startSetup(); $connection = $this->schemaSetup->getConnection(); $select = $connection->select() ->from($this->schemaSetup->getTable('store_website')) ->where('website_id = ?', 0); if ($connection->fetchOne($select) === false) { /** * Insert websites */ $connection->insertForce( $this->schemaSetup->getTable('store_website'), [ 'website_id' => 0, 'code' => WebsiteInterface::ADMIN_CODE, 'name' => 'Admin', 'sort_order' => 0, 'default_group_id' => 0, 'is_default' => 0 ] ); $connection->insertForce( $this->schemaSetup->getTable('store_website'), [ 'website_id' => 1, 'code' => 'base', 'name' => 'Main Website', 'sort_order' => 0, 'default_group_id' => 1, 'is_default' => 1 ] ); /** * Insert store groups */ $connection->insertForce( $this->schemaSetup->getTable('store_group'), [ 'group_id' => 0, 'website_id' => 0, 'name' => 'Default', 'root_category_id' => 0, 'default_store_id' => 0 ] ); $connection->insertForce( $this->schemaSetup->getTable('store_group'), [ 'group_id' => 1, 'website_id' => 1, 'name' => 'Main Website Store', 'root_category_id' => $this->getDefaultCategory()->getId(), 'default_store_id' => 1 ] ); /** * Insert stores */ $connection->insertForce( $this->schemaSetup->getTable('store'), [ 'store_id' => 0, 'code' => 'admin', 'website_id' => 0, 'group_id' => 0, 'name' => 'Admin', 'sort_order' => 0, 'is_active' => 1 ] ); $connection->insertForce( $this->schemaSetup->getTable('store'), [ 'store_id' => 1, 'code' => 'default', 'website_id' => 1, 'group_id' => 1, 'name' => 'Default Store View', 'sort_order' => 0, 'is_active' => 1 ] ); $this->schemaSetup->endSetup(); } } /** * Get default category. * * @deprecated 101.0.0 * @return DefaultCategory */ private function getDefaultCategory() { if ($this->defaultCategory === null) { $this->defaultCategory = $this->defaultCategoryFactory->create(); } return $this->defaultCategory; } /** * {@inheritdoc} */ public static function getDependencies() { return []; } /** * {@inheritdoc} */ public static function getVersion() { return '2.0.0'; } /** * {@inheritdoc} */ public function getAliases() { return []; } }