Problem/Motivation

#2849745: Replace documentation recommending db_*() wrappers is trying to fix all documentation which references db_*() functions.

Let's split out the database.api.php file and fix it, since it is the primary documentation for this API.

Proposed resolution

Fix the documentation in core/lib/Drupal/Core/Database/database.api.php to exclude the deprecated db_*() functions.

Also, this is a good documentation-only candidate for backport to 8.6.x, even during alpha.

Remaining tasks

User interface changes

API changes

Data model changes

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Mile23 created an issue. See original summary.

Mile23’s picture

Status: Active » Needs review
FileSize
6.6 KB

This is a straight re-roll of @yogeshmpawar's work in #2849745-21: Replace documentation recommending db_*() wrappers, using only the changes for database.api.php. All credit goes to them.

Mile23’s picture

Some edits and a few missed replacements.

alexpott’s picture

  1. +++ b/core/lib/Drupal/Core/Database/database.api.php
    @@ -30,19 +30,20 @@
    + * As a note, \Drupal::database() is used here as a shorthand way to get ahold
    + * of the database connection object. In most classes, you should use dependency
    

    ahold of - also ahold as far as I know is not a word.

  2. +++ b/core/lib/Drupal/Core/Database/database.api.php
    @@ -123,17 +120,19 @@
    + * As a note, \Drupal::database()->insert() and similar functions are wrappers
    

    I think As a note, is simpler as Note: - we've used this many times before. Whereas the are there are only 4 in core - including the 2 here.

  3. +++ b/core/lib/Drupal/Core/Database/database.api.php
    @@ -150,21 +149,23 @@
    + * call @code $transaction = \Drupal::database()->startTransaction(); @endcode
    

    Just looking at https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Core%21Database%... - I\m not sure that @code is really meant to be used inline but that's not introduced here.

Mile23’s picture

Good points. But I feel so provincial now that I tried to Google 'ahold.' :-)

alexpott’s picture

There's one more As a note

+++ b/core/lib/Drupal/Core/Database/database.api.php
@@ -123,17 +120,19 @@
+ * As a note, \Drupal::database()->insert() and similar functions are wrappers
Mile23’s picture

Also found another inline @code.

voleger’s picture

Status: Needs review » Reviewed & tested by the community

Looks good

alexpott’s picture

Version: 8.7.x-dev » 8.6.x-dev
Status: Reviewed & tested by the community » Fixed

Committed and pushed e3d81645d3 to 8.7.x and a13f7aca22 to 8.6.x. Thanks!

As a docs fix backported to 8.6.x

  • alexpott committed e3d8164 on 8.7.x
    Issue #2987399 by Mile23, alexpott: Update database.api.php to remove...

  • alexpott committed a13f7ac on 8.6.x
    Issue #2987399 by Mile23, alexpott: Update database.api.php to remove...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.