You are here

public function EntityUsage::__construct in Entity Usage 8.3

Same name and namespace in other branches
  1. 8.4 src/EntityUsage.php \Drupal\entity_usage\EntityUsage::__construct()
  2. 8 src/EntityUsage.php \Drupal\entity_usage\EntityUsage::__construct()
  3. 8.2 src/EntityUsage.php \Drupal\entity_usage\EntityUsage::__construct()

Construct the EntityUsage object.

Parameters

\Drupal\Core\Database\Connection $connection: The database connection which will be used to store the entity usage information.

\Symfony\Component\EventDispatcher\EventDispatcherInterface $event_dispatcher: An event dispatcher instance to use for events.

\Drupal\Core\Config\ConfigFactoryInterface $config_factory: The config factory.

\Drupal\Core\Extension\ModuleHandlerInterface $module_handler: The ModuleHandler service.

string $table: (optional) The table to store the entity usage info. Defaults to 'entity_usage'.

File

src/EntityUsage.php, line 70

Class

EntityUsage
Defines the entity usage base class.

Namespace

Drupal\entity_usage

Code

public function __construct(Connection $connection, EventDispatcherInterface $event_dispatcher, ConfigFactoryInterface $config_factory, ModuleHandlerInterface $module_handler, $table = 'entity_usage') {
  $this->connection = $connection;
  $this->tableName = $table;
  $this->eventDispatcher = $event_dispatcher;
  $this->moduleHandler = $module_handler;
  $this->config = $config_factory
    ->get('entity_usage.settings');
}