SchemaComparison.php in Schema 8
File
src/Comparison/Result/SchemaComparison.php
View source
<?php
namespace Drupal\schema\Comparison\Result;
class SchemaComparison {
protected $warnings;
protected $tables_extra = array();
protected $tables_missing = array();
protected $tables_compared = array();
public function addWarning($warning) {
$this->warnings[] = $warning;
}
public function addMissingTable($name, $definition) {
$this->tables_missing[$name] = new MissingTable($name, $definition);
}
public function addExtraTable($name, $schema) {
$this->tables_extra[$name] = new ExtraTable($name, $schema);
}
public function getTableComparison($name, $schema = NULL) {
if (!isset($this->tables_compared[$name])) {
$this->tables_compared[$name] = new TableComparison($name, $schema);
}
return $this->tables_compared[$name];
}
public function getTableNames() {
$tables = array_merge(array_keys($this->tables_extra), array_keys($this->tables_missing), array_keys($this->tables_compared));
return $tables;
}
public function getComparedTables() {
return $this->tables_compared;
}
public function getSameTables() {
return array_filter($this->tables_compared, function ($table) {
return $table
->isStatusSame();
});
}
public function getDifferentTables() {
return array_filter($this->tables_compared, function ($table) {
return $table
->isStatusDifferent();
});
}
public function getWarnings() {
return $this->warnings;
}
public function getMissingTables() {
return $this->tables_missing;
}
public function getExtraTables() {
return $this->tables_extra;
}
}