Open Data Catalog v2.0.0
DatabaseTableFactory.php
Go to the documentation of this file.
1 <?php
2 
4 
5 use Contracts\FactoryInterface;
6 use Drupal\Core\Database\Connection;
7 
11 class DatabaseTableFactory implements FactoryInterface {
12  private $connection;
13  private $storage = [];
14 
18  public function __construct(Connection $connection) {
19  $this->connection = $connection;
20  }
21 
27  public function getInstance(string $identifier, array $config = []) {
28  if (!isset($this->storage[$identifier])) {
29  $this->storage[$identifier] = $this->getDatabaseTable($identifier);
30  }
31  return $this->storage[$identifier];
32  }
33 
37  protected function getDatabaseTable($identifier) {
38  return new DatabaseTable($this->connection, $identifier);
39  }
40 
41 }
Drupal\dkan_harvest\Storage\DatabaseTableFactory\__construct
__construct(Connection $connection)
Definition: DatabaseTableFactory.php:18
Drupal\dkan_harvest\Storage\DatabaseTable
Definition: DatabaseTable.php:11
Drupal\dkan_harvest\Storage\DatabaseTableFactory\getDatabaseTable
getDatabaseTable($identifier)
Definition: DatabaseTableFactory.php:37
Drupal\dkan_harvest\Storage
Definition: DatabaseTable.php:3
Drupal\dkan_harvest\Storage\DatabaseTableFactory
Definition: DatabaseTableFactory.php:11
Drupal\dkan_harvest\Storage\DatabaseTableFactory\getInstance
getInstance(string $identifier, array $config=[])
Definition: DatabaseTableFactory.php:27