createTables example

$this->modelManager = $modelManager;
        $this->provider = $provider;
        $this->menuSynchronizer = $menuSynchronizer;
        $this->aclSynchronizer = $aclSynchronizer;
    }

    public function sync(bool $destructive = false): array
    {
        $types = $this->provider->getTypes();

        $this->menuSynchronizer->synchronize(self::getMenuEntries($types));
        $this->createTables($types$destructive);
        $this->aclSynchronizer->update(array_map(static function DType $type) {
            return strtolower($type->getControllerName());
        }$types));

        return $types;
    }

    public function setTypeProvider(TypeProvider $typeProvider): void
    {
        $this->provider = $typeProvider;
    }

    

#[Package('core')] class Migration1572193798TaxRule extends MigrationStep
{
    public function getCreationTimestamp(): int
    {
        return 1572193798;
    }

    public function update(Connection $connection): void
    {
        $this->createTables($connection);
        $this->addTaxRuleTypes($connection);
    }

    public function updateDestructive(Connection $connection): void
    {
        // implement update destructive     }

    public function createTables(Connection $connection): void
    {
        $connection->executeStatement(' CREATE TABLE `tax_rule_type` ( `id` BINARY(16) NOT NULL, `technical_name` VARCHAR(255) COLLATE utf8mb4_unicode_ci NOT NULL, `position` INT(11) NOT NULL, `created_at` DATETIME(3) NOT NULL, `updated_at` DATETIME(3) NULL, PRIMARY KEY (`id`), UNIQUE KEY `uniq.technical_name` (`technical_name`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; ');
$candidates = $provider->getCandidateOutlines([]);
    $this->assertCount(0, $candidates, 'Empty parts should return no candidates.');
  }

  /** * Confirms that we can find routes with the exact incoming path. */
  public function testExactPathMatch() {
    $connection = Database::getConnection();
    $provider = new RouteProvider($connection$this->state, $this->currentPath, $this->cache, $this->pathProcessor, $this->cacheTagsInvalidator, 'test_routes');

    $this->fixtures->createTables($connection);

    $dumper = new MatcherDumper($connection$this->state, $this->logger, 'test_routes');
    $dumper->addRoutes($this->fixtures->sampleRouteCollection());
    $dumper->dump();

    $path = '/path/one';

    $request = Request::create($path, 'GET');

    $routes = $provider->getRouteCollectionForRequest($request);

    
public function testDump() {
    $connection = Database::getConnection();
    $dumper = new MatcherDumper($connection$this->state, $this->logger, 'test_routes');

    $route = new Route('/test/{my}/path');
    $route->setOption('compiler_class', RouteCompiler::class);
    $collection = new RouteCollection();
    $collection->add('test_route', $route);

    $dumper->addRoutes($collection);

    $this->fixtures->createTables($connection);

    $dumper->dump(['provider' => 'test']);

    $record = $connection->select('test_routes', 'tr')
      ->fields('tr')
      ->condition('name', 'test_route')
      ->execute()
      ->fetchObject();

    $loaded_route = unserialize($record->route);

    


class Migrations_Migration372 extends Shopware\Components\Migrations\AbstractMigration
{
    public function up($modus)
    {
        $this->createTables();
        $this->addAcl();
        $this->addSampleData();
    }

    private function createTables()
    {
        $sql = <<<'EOD' CREATE TABLE IF NOT EXISTS `s_multi_edit_filter` ( `id` int(11) unsigned NOT NULL AUTO_INCREMENT, `name` varchar(255) NOT NULL COMMENT 'Name of the filter', `filter_string` text COLLATE utf8_unicode_ci NOT NULL COMMENT 'The actual filter string', `description` text COLLATE utf8_unicode_ci NOT NULL COMMENT 'User description of the filter', `created` datetime DEFAULT 0 COMMENT 'Creation date', `is_favorite` tinyint(1) DEFAULT 0 NOT NULL COMMENT 'Did the user mark this filter as favorite?', `is_simple` tinyint(1) DEFAULT 0 NOT NULL COMMENT 'Can the filter be loaded and modified with the simple editor?', PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 COMMENT 'Holds all multi edit filters';


    public function getCreationTimestamp(): int
    {
        return 1590758953;
    }

    public function update(Connection $connection): void
    {
        $defaultFeatureSetId = Uuid::randomBytes();

        $this->createTables($connection);
        $this->updateTables($connection);

        $this->insertDefaultFeatureSet($connection$defaultFeatureSetId);
        $this->insertDefaultFeatureSetTranslations($connection$defaultFeatureSetId);
        $this->assignDefaultFeatureSet($connection$defaultFeatureSetId);
    }

    public function updateDestructive(Connection $connection): void
    {
    }

    
#[Package('core')] class Migration1596441551CustomerGroupRegistration extends MigrationStep
{
    public function getCreationTimestamp(): int
    {
        return 1596441551;
    }

    public function update(Connection $connection): void
    {
        $this->updateCustomerTable($connection);
        $this->createTables($connection);
        $this->createMailTypes($connection);
    }

    public function updateDestructive(Connection $connection): void
    {
    }

    public function createMailTypes(Connection $connection): void
    {
        $enLangId = $this->fetchLanguageId('en-GB', $connection);
        $deLangId = $this->fetchLanguageId('de-DE', $connection);

        
Home | Imprint | This part of the site doesn't use cookies.