From bf6655a534a6775d30cafa67bd801276bda1d98d Mon Sep 17 00:00:00 2001 From: polo Date: Tue, 13 Aug 2024 23:45:21 +0200 Subject: =?UTF-8?q?VERSION=200.2=20doctrine=20ORM=20et=20entit=C3=A9s?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- vendor/doctrine/dbal/src/Schema/SchemaDiff.php | 109 +++++++++++++++++++++++++ 1 file changed, 109 insertions(+) create mode 100644 vendor/doctrine/dbal/src/Schema/SchemaDiff.php (limited to 'vendor/doctrine/dbal/src/Schema/SchemaDiff.php') diff --git a/vendor/doctrine/dbal/src/Schema/SchemaDiff.php b/vendor/doctrine/dbal/src/Schema/SchemaDiff.php new file mode 100644 index 0000000..28c014d --- /dev/null +++ b/vendor/doctrine/dbal/src/Schema/SchemaDiff.php @@ -0,0 +1,109 @@ + */ + private readonly array $alteredTables; + + /** + * Constructs an SchemaDiff object. + * + * @internal The diff can be only instantiated by a {@see Comparator}. + * + * @param array $createdSchemas + * @param array $droppedSchemas + * @param array $createdTables + * @param array $alteredTables + * @param array
$droppedTables + * @param array $createdSequences + * @param array $alteredSequences + * @param array $droppedSequences + */ + public function __construct( + private readonly array $createdSchemas, + private readonly array $droppedSchemas, + private readonly array $createdTables, + array $alteredTables, + private readonly array $droppedTables, + private readonly array $createdSequences, + private readonly array $alteredSequences, + private readonly array $droppedSequences, + ) { + $this->alteredTables = array_filter($alteredTables, static function (TableDiff $diff): bool { + return ! $diff->isEmpty(); + }); + } + + /** @return array */ + public function getCreatedSchemas(): array + { + return $this->createdSchemas; + } + + /** @return array */ + public function getDroppedSchemas(): array + { + return $this->droppedSchemas; + } + + /** @return array
*/ + public function getCreatedTables(): array + { + return $this->createdTables; + } + + /** @return array */ + public function getAlteredTables(): array + { + return $this->alteredTables; + } + + /** @return array
*/ + public function getDroppedTables(): array + { + return $this->droppedTables; + } + + /** @return array */ + public function getCreatedSequences(): array + { + return $this->createdSequences; + } + + /** @return array */ + public function getAlteredSequences(): array + { + return $this->alteredSequences; + } + + /** @return array */ + public function getDroppedSequences(): array + { + return $this->droppedSequences; + } + + /** + * Returns whether the diff is empty (contains no changes). + */ + public function isEmpty(): bool + { + return count($this->createdSchemas) === 0 + && count($this->droppedSchemas) === 0 + && count($this->createdTables) === 0 + && count($this->alteredTables) === 0 + && count($this->droppedTables) === 0 + && count($this->createdSequences) === 0 + && count($this->alteredSequences) === 0 + && count($this->droppedSequences) === 0; + } +} -- cgit v1.2.3