MetaModels\Attribute\BaseSimple::renameColumn PHP Метод

renameColumn() публичный Метод

Renames the underlying database structure for this field.
public renameColumn ( string $strNewColumnName ) : void
$strNewColumnName string The new column name.
Результат void
    public function renameColumn($strNewColumnName)
    {
        TableManipulation::checkColumnName($strNewColumnName);
        if ($this->getColName() && $this->getMetaModel()->getServiceContainer()->getDatabase()->fieldExists($this->getColName(), $this->getMetaModel()->getTableName(), true)) {
            TableManipulation::renameColumn($this->getMetaModel()->getTableName(), $this->getColName(), $strNewColumnName, $this->getSQLDataType());
        } else {
            $strBackupColName = $this->getColName();
            $this->set('colname', $strNewColumnName);
            $this->createColumn();
            $this->set('colname', $strBackupColName);
        }
    }