You are here

Example: Database (DBTNG) in Examples for Developers 3.x

Same name and namespace in other branches
  1. 8 dbtng_example/dbtng_example.module \dbtng_example
  2. 7 dbtng_example/dbtng_example.module \dbtng_example

Database examples, including DBTNG.

'DBTNG' means 'Database: The Next Generation.' Yes, Drupallers are nerds.

The interesting database queries for this example module are located in the \Drupal\dbtng_example\DbtngExampleRepository class.

General documentation is available at Database API.

See also

Database abstraction layer

\Drupal\dbtng_example\DbtngExampleRepository

\Drupal\Core\Database\Connection:delete()

\Drupal\Core\Database\Connection:insert()

\Drupal\Core\Database\Connection:select()

\Drupal\Core\Database\Connection:update()

Parent topics

File

modules/dbtng_example/dbtng_example.module, line 11
This is an example outlining how a module can use the DBTNG database API.

Functions

Namesort descending Location Description
dbtng_example_install modules/dbtng_example/dbtng_example.install Implements hook_install().
dbtng_example_schema modules/dbtng_example/dbtng_example.install Implements hook_schema().

Classes

Namesort descending Location Description
DbtngExampleAddForm modules/dbtng_example/src/Form/DbtngExampleAddForm.php Form to add a database entry, with all the interesting fields.
DbtngExampleController modules/dbtng_example/src/Controller/DbtngExampleController.php Controller for DBTNG Example.
DbtngExampleRepository modules/dbtng_example/src/DbtngExampleRepository.php Repository for database-related helper methods for our example.
DbtngExampleRepositoryTest modules/dbtng_example/tests/src/Kernel/DbtngExampleRepositoryTest.php Kernel testing of the DbtngExampleRepository service.
DbtngExampleTest modules/dbtng_example/tests/src/Functional/DbtngExampleTest.php Tests for the dbtng_example module.
DbtngExampleUpdateForm modules/dbtng_example/src/Form/DbtngExampleUpdateForm.php Sample UI to update a record.