Problem/Motivation

Hard-coding to an SQL backend is bad mk

Proposed resolution

Use the entity API

Remaining tasks

Reviews

User interface changes

None

API changes

None

Data model changes

None

Issue fork drupal-2569147

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

larowlan created an issue. See original summary.

Status: Needs review » Needs work

The last submitted patch, comment-argument-useruid-sql.1.patch, failed testing.

The last submitted patch, comment-argument-useruid-sql.1.patch, failed testing.

olli’s picture

Status: Needs work » Needs review
Issue tags: +VDC
FileSize
1.04 KB
596 bytes

Rebased and fixed TrackerUserUidTest.

I'm not sure if it is possible to remove this->database from the query() method but I think user->getUsername() is better than a db query.

Version: 8.0.x-dev » 8.1.x-dev

Drupal 8.0.6 was released on April 6 and is the final bugfix release for the Drupal 8.0.x series. Drupal 8.0.x will not receive any further development aside from security fixes. Drupal 8.1.0-rc1 is now available and sites should prepare to update to 8.1.0.

Bug reports should be targeted against the 8.1.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.2.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.1.x-dev » 8.2.x-dev

Drupal 8.1.9 was released on September 7 and is the final bugfix release for the Drupal 8.1.x series. Drupal 8.1.x will not receive any further development aside from security fixes. Drupal 8.2.0-rc1 is now available and sites should prepare to upgrade to 8.2.0.

Bug reports should be targeted against the 8.2.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.6 was released on February 1, 2017 and is the final full bugfix release for the Drupal 8.2.x series. Drupal 8.2.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.3.0 on April 5, 2017. (Drupal 8.3.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.3.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.3.x-dev » 8.4.x-dev

Drupal 8.3.6 was released on August 2, 2017 and is the final full bugfix release for the Drupal 8.3.x series. Drupal 8.3.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.4.0 on October 4, 2017. (Drupal 8.4.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.4.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.4 was released on January 3, 2018 and is the final full bugfix release for the Drupal 8.4.x series. Drupal 8.4.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.5.0 on March 7, 2018. (Drupal 8.5.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.5.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.6 was released on August 1, 2018 and is the final bugfix release for the Drupal 8.5.x series. Drupal 8.5.x will not receive any further development aside from security fixes. Sites should prepare to update to 8.6.0 on September 5, 2018. (Drupal 8.6.0-rc1 is available for testing.)

Bug reports should be targeted against the 8.6.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.6.x-dev » 8.8.x-dev

Drupal 8.6.x will not receive any further development aside from security fixes. Bug reports should be targeted against the 8.8.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.9.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.7 was released on June 3, 2020 and is the final full bugfix release for the Drupal 8.8.x series. Drupal 8.8.x will not receive any further development aside from security fixes. Sites should prepare to update to Drupal 8.9.0 or Drupal 9.0.0 for ongoing support.

Bug reports should be targeted against the 8.9.x-dev branch from now on, and new development or disruptive changes should be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.9.x-dev » 9.2.x-dev

Drupal 8 is end-of-life as of November 17, 2021. There will not be further changes made to Drupal 8. Bugfixes are now made to the 9.3.x and higher branches only. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.2.x-dev » 9.3.x-dev

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.15 was released on June 1st, 2022 and is the final full bugfix release for the Drupal 9.3.x series. Drupal 9.3.x will not receive any further development aside from security fixes. Drupal 9 bug reports should be targeted for the 9.4.x-dev branch from now on, and new development or disruptive changes should be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

smustgrave’s picture

Status: Needs review » Needs work
Issue tags: +Needs reroll
Medha Kumari’s picture

Version: 9.4.x-dev » 9.5.x-dev
Status: Needs work » Needs review
Issue tags: -Needs reroll
FileSize
1.05 KB

Rerolled the patch #4 in Drupal 9.5.x.

Medha Kumari’s picture

Rerolled patch #17 in Drupal 9.5.x. and fixed custom command failed

Status: Needs review » Needs work

The last submitted patch, 18: 2569147-18.patch, failed testing. View results

Medha Kumari’s picture

Fixing Error in #18

Akram Khan’s picture

Status: Needs work » Needs review
FileSize
1.06 KB
771 bytes

Fix CCF #20

Status: Needs review » Needs work

The last submitted patch, 21: 2569147-21.patch, failed testing. View results

Ankit.Gupta’s picture

Status: Needs work » Needs review
FileSize
836 bytes

The last submitted patch, 23: 2569147-23.patch, failed testing. View results

smustgrave’s picture

Status: Needs review » Reviewed & tested by the community
Issue tags: +Needs Review Queue Initiative

This issue is being reviewed by the kind folks in Slack, #need-reveiw-queue. We are working to keep the size of Needs Review queue [2700+ issues] to around 200, following Review a patch or merge require as a guide.

Thank you @Spokje for fixing up that patch.

Change looks good to me and see it passes 9.5, 10.0, and 10.1 (so much green!)

quietone’s picture

Version: 9.5.x-dev » 10.1.x-dev
Status: Reviewed & tested by the community » Needs work
Issue tags: +Novice

I talked to larowlan about this and we agree that this can use the null safe operator. $title = $user?->getDisplayName();.

Also, this is a 10.1.x only change. Therefor I have changed the version.

This is suitable for a novice, adding tag.

govind.maloo made their first commit to this issue’s fork.

Spokje’s picture

Status: Needs work » Needs review
smustgrave’s picture

Status: Needs review » Reviewed & tested by the community

Only open thread

This is a plugin, should we override the ::create method from the parent and inject the entity-type manager and load the user that way instead of using the User singleton?

You mentioned it may not be worth the effort and for a small change that path would require a change record, trigger_error (I would imagine), and then tests.

Just my thought.

alexpott’s picture

Status: Reviewed & tested by the community » Needs work

This is actually a bug fix as it is correctly changing the title from the user's account to the display name.

I wonder what this change means for argument's summary name field... in UserViewsData we do:

    $data['users_field_data']['uid']['argument'] += [
      'name table' => 'users_field_data',
      'name field' => 'name',
      'empty field name' => \Drupal::config('user.settings')->get('anonymous'),
    ];

But now this argument is using the display name which might have nothing to do with account name. I think we need to address this inconsistency if we change to display name here. FWIW off the top of my head I have no idea what summary queries do :)

sahil.goyal made their first commit to this issue’s fork.

sahil.goyal’s picture

Updated the plugin to use dependency injection for the entity-type manager instead of the global singleton \Drupal\user\Entity\User::load(). Instantiate the plugin with the entity-type manager, and modified the execute() method to load the user entity using the injected entity-type manager.

sahil.goyal’s picture

Status: Needs work » Needs review
smustgrave’s picture

Status: Needs review » Needs work
Issue tags: +Needs change record

Now I believe this will need to default to NULL and trigger_error when the Entity Type Manager isn't passed in.

Should have test coverage I believe too.

#32 still needs an answer also.

Version: 10.1.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch, which currently accepts only minor-version allowed changes. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.