mirror of
https://github.com/zoe-may/TDoG-Skin.git
synced 2024-11-24 22:02:22 +08:00
60 lines
1.2 KiB
PHP
60 lines
1.2 KiB
PHP
|
<?php
|
||
|
|
||
|
namespace Doctrine\DBAL\Schema;
|
||
|
|
||
|
use function in_array;
|
||
|
|
||
|
/**
|
||
|
* Represents the change of a column.
|
||
|
*/
|
||
|
class ColumnDiff
|
||
|
{
|
||
|
/** @var string */
|
||
|
public $oldColumnName;
|
||
|
|
||
|
/** @var Column */
|
||
|
public $column;
|
||
|
|
||
|
/** @var string[] */
|
||
|
public $changedProperties = [];
|
||
|
|
||
|
/** @var Column|null */
|
||
|
public $fromColumn;
|
||
|
|
||
|
/**
|
||
|
* @param string $oldColumnName
|
||
|
* @param string[] $changedProperties
|
||
|
*/
|
||
|
public function __construct(
|
||
|
$oldColumnName,
|
||
|
Column $column,
|
||
|
array $changedProperties = [],
|
||
|
?Column $fromColumn = null
|
||
|
) {
|
||
|
$this->oldColumnName = $oldColumnName;
|
||
|
$this->column = $column;
|
||
|
$this->changedProperties = $changedProperties;
|
||
|
$this->fromColumn = $fromColumn;
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* @param string $propertyName
|
||
|
*
|
||
|
* @return bool
|
||
|
*/
|
||
|
public function hasChanged($propertyName)
|
||
|
{
|
||
|
return in_array($propertyName, $this->changedProperties);
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* @return Identifier
|
||
|
*/
|
||
|
public function getOldColumnName()
|
||
|
{
|
||
|
$quote = $this->fromColumn && $this->fromColumn->isQuoted();
|
||
|
|
||
|
return new Identifier($this->oldColumnName, $quote);
|
||
|
}
|
||
|
}
|