You are here

public static function IntColumnHandler::allColumnsExist in Dynamic Entity Reference 8.2

Checks whether all columns exist.

Parameters

\Drupal\Core\Database\Schema $schema: The database Schema object for this connection.

string $table: The name of the table in drupal (no prefixing).

string[] $columns: The names of the columns.

Return value

bool TRUE if all the given columns exists, otherwise FALSE.

2 calls to IntColumnHandler::allColumnsExist()
IntColumnHandler::create in src/Storage/IntColumnHandler.php
Creates the _int columns and the triggers for them.
IntColumnHandlerPostgreSQL::create in src/Storage/IntColumnHandlerPostgreSQL.php
Creates the _int columns and the triggers for them.

File

src/Storage/IntColumnHandler.php, line 43

Class

IntColumnHandler
Per database implementation of denormalizing into integer columns.

Namespace

Drupal\dynamic_entity_reference\Storage

Code

public static function allColumnsExist(Schema $schema, $table, array $columns) {
  foreach ($columns as $column) {

    // When a new module adds more than one new basefields in
    // hook_entity_base_field_info() then the entity system will report those
    // but they won't exist yet in the database. It's enough to fire when
    // called for the last one.
    if (!$schema
      ->fieldExists($table, $column)) {
      return FALSE;
    }
  }
  return TRUE;
}