Exception
2 years ago
Visitor
9 months ago
AbstractAsset.php
2 years ago
AbstractSchemaManager.php
9 months ago
Column.php
2 years ago
ColumnDiff.php
2 years ago
Comparator.php
2 years ago
Constraint.php
2 years ago
DB2SchemaManager.php
2 years ago
DefaultSchemaManagerFactory.php
2 years ago
ForeignKeyConstraint.php
9 months ago
Identifier.php
2 years ago
Index.php
2 years ago
LegacySchemaManagerFactory.php
2 years ago
MySQLSchemaManager.php
9 months ago
OracleSchemaManager.php
2 years ago
PostgreSQLSchemaManager.php
9 months ago
SQLServerSchemaManager.php
9 months ago
Schema.php
2 years ago
SchemaConfig.php
2 years ago
SchemaDiff.php
2 years ago
SchemaException.php
2 years ago
SchemaManagerFactory.php
2 years ago
Sequence.php
2 years ago
SqliteSchemaManager.php
8 months ago
Table.php
2 years ago
TableDiff.php
2 years ago
UniqueConstraint.php
2 years ago
View.php
2 years ago
ColumnDiff.php
87 lines
| 1 | <?php |
| 2 | namespace MailPoetVendor\Doctrine\DBAL\Schema; |
| 3 | if (!defined('ABSPATH')) exit; |
| 4 | use MailPoetVendor\Doctrine\Deprecations\Deprecation; |
| 5 | use function in_array; |
| 6 | class ColumnDiff |
| 7 | { |
| 8 | public $oldColumnName; |
| 9 | public $column; |
| 10 | public $changedProperties = []; |
| 11 | public $fromColumn; |
| 12 | public function __construct($oldColumnName, Column $column, array $changedProperties = [], ?Column $fromColumn = null) |
| 13 | { |
| 14 | if ($fromColumn === null) { |
| 15 | Deprecation::triggerIfCalledFromOutside('doctrine/dbal', 'https://github.com/doctrine/dbal/pull/4785', 'Not passing the $fromColumn to %s is deprecated.', __METHOD__); |
| 16 | } |
| 17 | $this->oldColumnName = $oldColumnName; |
| 18 | $this->column = $column; |
| 19 | $this->changedProperties = $changedProperties; |
| 20 | $this->fromColumn = $fromColumn; |
| 21 | } |
| 22 | public function getOldColumn() : ?Column |
| 23 | { |
| 24 | return $this->fromColumn; |
| 25 | } |
| 26 | public function getNewColumn() : Column |
| 27 | { |
| 28 | return $this->column; |
| 29 | } |
| 30 | public function hasTypeChanged() : bool |
| 31 | { |
| 32 | return $this->hasChanged('type'); |
| 33 | } |
| 34 | public function hasLengthChanged() : bool |
| 35 | { |
| 36 | return $this->hasChanged('length'); |
| 37 | } |
| 38 | public function hasPrecisionChanged() : bool |
| 39 | { |
| 40 | return $this->hasChanged('precision'); |
| 41 | } |
| 42 | public function hasScaleChanged() : bool |
| 43 | { |
| 44 | return $this->hasChanged('scale'); |
| 45 | } |
| 46 | public function hasUnsignedChanged() : bool |
| 47 | { |
| 48 | return $this->hasChanged('unsigned'); |
| 49 | } |
| 50 | public function hasFixedChanged() : bool |
| 51 | { |
| 52 | return $this->hasChanged('fixed'); |
| 53 | } |
| 54 | public function hasNotNullChanged() : bool |
| 55 | { |
| 56 | return $this->hasChanged('notnull'); |
| 57 | } |
| 58 | public function hasDefaultChanged() : bool |
| 59 | { |
| 60 | return $this->hasChanged('default'); |
| 61 | } |
| 62 | public function hasAutoIncrementChanged() : bool |
| 63 | { |
| 64 | return $this->hasChanged('autoincrement'); |
| 65 | } |
| 66 | public function hasCommentChanged() : bool |
| 67 | { |
| 68 | return $this->hasChanged('comment'); |
| 69 | } |
| 70 | public function hasChanged($propertyName) |
| 71 | { |
| 72 | return in_array($propertyName, $this->changedProperties, \true); |
| 73 | } |
| 74 | public function getOldColumnName() |
| 75 | { |
| 76 | Deprecation::trigger('doctrine/dbal', 'https://github.com/doctrine/dbal/pull/5622', '%s is deprecated. Use $fromColumn instead.', __METHOD__); |
| 77 | if ($this->fromColumn !== null) { |
| 78 | $name = $this->fromColumn->getName(); |
| 79 | $quote = $this->fromColumn->isQuoted(); |
| 80 | } else { |
| 81 | $name = $this->oldColumnName; |
| 82 | $quote = \false; |
| 83 | } |
| 84 | return new Identifier($name, $quote); |
| 85 | } |
| 86 | } |
| 87 |