src/Helper/TableManipulation.php
public static function setVariantSupport($strTableName, $blnVariantSupport)
    {
        if ($blnVariantSupport) {
            if (self::getDB()->tableExists($strTableName, null, true)
                && (!self::getDB()->fieldExists('varbase', $strTableName, true))
            ) {
                self::createColumn($strTableName, 'varbase', 'char(1) NOT NULL default \'\'', true);
                self::createColumn($strTableName, 'vargroup', 'int(11) NOT NULL default 0', true);

                // If there is pre-existing data in the table, we need to provide a separate 'vargroup' value to all of
                // them, we can do this safely by setting all vargroups to the id of the base item.
                self::getDB()->execute(sprintf('UPDATE %s SET vargroup=id, varbase=1', $strTableName));
            }
        } else {
            if (self::getDB()->tableExists($strTableName, null, true)
                && self::getDB()->fieldExists('varbase', $strTableName, true)
            ) {
                self::dropColumn($strTableName, 'varbase', true);
                self::dropColumn($strTableName, 'vargroup', true);
            }
        }
    }
public static function setVariantSupport($strTableName, $blnVariantSupport)
    {
        if ($blnVariantSupport) {
            if (self::getDB()->tableExists($strTableName, null, true)
                && (!self::getDB()->fieldExists('varbase', $strTableName, true))
            ) {
                self::createColumn($strTableName, 'varbase', 'char(1) NOT NULL default \'\'', true);
                self::createColumn($strTableName, 'vargroup', 'int(11) NOT NULL default 0', true);

                // If there is pre-existing data in the table, we need to provide a separate 'vargroup' value to all of
                // them, we can do this safely by setting all vargroups to the id of the base item.
                self::getDB()->execute(sprintf('UPDATE %s SET vargroup=id, varbase=1', $strTableName));
            }
        } else {
            if (self::getDB()->tableExists($strTableName, null, true)
                && self::getDB()->fieldExists('varbase', $strTableName, true)
            ) {
                self::dropColumn($strTableName, 'varbase', true);
                self::dropColumn($strTableName, 'vargroup', true);
            }
        }
    }
public static function setVariantSupport ( $ strTableName , $ blnVariantSupport ) { if ( $ blnVariantSupport ) { if ( self :: getDB ( ) -> tableExists ( $ strTableName , null , true ) && ( ! self :: getDB ( ) -> fieldExists ( 'varbase' , $ strTableName , true ) ) ) { self :: createColumn ( $ strTableName , 'varbase' , 'char(1) NOT NULL default \'\'' , true ) ; self :: createColumn ( $ strTableName , 'vargroup' , 'int(11) NOT NULL default 0' , true ) ; // If there is pre-existing data in the table, we need to provide a separate 'vargroup' value to all of // them, we can do this safely by setting all vargroups to the id of the base item. self :: getDB ( ) -> execute ( sprintf ( 'UPDATE %s SET vargroup=id, varbase=1' , $ strTableName ) ) ; } } else { if ( self :: getDB ( ) -> tableExists ( $ strTableName , null , true ) && self :: getDB ( ) -> fieldExists ( 'varbase' , $ strTableName , true ) ) { self :: dropColumn ( $ strTableName , 'varbase' , true ) ; self :: dropColumn ( $ strTableName , 'vargroup' , true ) ; } } }
Enables or disables Variant support on a certain MetaModel table.

@param string $strTableName      The table name of the MetaModel.

@param bool   $blnVariantSupport Flag if the support shall be turned on or off.

@return void
Enables or disables Variant support on a certain MetaModel table .