updateInheritance example

class Migration1610523204AddInheritanceForProductCmsPage extends MigrationStep
{
    use InheritanceUpdaterTrait;

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

    public function update(Connection $connection): void
    {
        $this->updateInheritance($connection, 'product', 'cmsPage');
    }

    public function updateDestructive(Connection $connection): void
    {
    }
}
SQL;
        $connection->executeStatement($sql);

        $this->updateInheritance($connection, 'product', 'customFieldSets');
    }

    /** * @throws Exception */
    private function addGlobalFlag(Connection $connection): void
    {
        $sql = <<<'SQL' ALTER TABLE `custom_field_set` ADD `global` tinyint(1) NOT NULL DEFAULT 0 AFTER `active`; SQL;
        
ALTER TABLE `product` ADD COLUMN `product_feature_set_id` BINARY(16) NULL AFTER `unit_id`; ALTER TABLE `product` ADD CONSTRAINT `fk.product.feature_set_id` FOREIGN KEY (`product_feature_set_id`) REFERENCES `product_feature_set` (`id`) ON DELETE SET NULL ON UPDATE CASCADE; SQL;

            $connection->executeStatement($sql);
        }

        if ($featureSetInheritanceColumn === false) {
            $this->updateInheritance($connection, 'product', 'featureSet');
        }
    }

    private function insertDefaultFeatureSet(Connection $connection, string $featureSetId): void
    {
        $connection->insert(
            ProductFeatureSetDefinition::ENTITY_NAME,
            $this->getDefaultFeatureSet($featureSetId)
        );
    }

    


        $this->updateInheritance($connection, 'product', 'crossSellings');
        $this->registerIndexer($connection, 'Swag.InheritanceIndexer');
    }

    public function updateDestructive(Connection $connection): void
    {
        // nth     }
}
Home | Imprint | This part of the site doesn't use cookies.