You are here

public function IndexerBase::bind in Drupal 7 to 8/9 Module Upgrader 8

Overrides IndexerInterface::bind

1 call to IndexerBase::bind()
IndexerBase::__construct in src/IndexerBase.php
Constructs a \Drupal\Component\Plugin\PluginBase object.

File

src/IndexerBase.php, line 56

Class

IndexerBase
Base class for indexers.

Namespace

Drupal\drupalmoduleupgrader

Code

public function bind(TargetInterface $module) {
  $this->target = $module;
  $this->table = $module
    ->id() . '__' . $this
    ->getPluginId();
  $schema = $this->db
    ->schema();
  if ($schema
    ->tableExists($this->table)) {
    $this
      ->clear();
  }
  else {
    $schema
      ->createTable($this->table, [
      'fields' => $this
        ->getFields(),
    ]);
  }
  $this
    ->build();
}