You are here

public function DbtngExampleRepository::__construct in Examples for Developers 3.x

Same name and namespace in other branches
  1. 8 dbtng_example/src/DbtngExampleRepository.php \Drupal\dbtng_example\DbtngExampleRepository::__construct()

Construct a repository object.

Parameters

\Drupal\Core\Database\Connection $connection: The database connection.

\Drupal\Core\StringTranslation\TranslationInterface $translation: The translation service.

\Drupal\Core\Messenger\MessengerInterface $messenger: The messenger service.

File

modules/dbtng_example/src/DbtngExampleRepository.php, line 50

Class

DbtngExampleRepository
Repository for database-related helper methods for our example.

Namespace

Drupal\dbtng_example

Code

public function __construct(Connection $connection, TranslationInterface $translation, MessengerInterface $messenger) {
  $this->connection = $connection;
  $this
    ->setStringTranslation($translation);
  $this
    ->setMessenger($messenger);
}