Drupal\comment\Plugin\views\argument\UserUid relies on SQL backend

Created on 15 September 2015, almost 9 years ago
Updated 24 April 2023, about 1 year ago

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

๐Ÿ“Œ Task
Status

Needs work

Version

10.1 โœจ

Component
Commentย  โ†’

Last updated 3 days ago

Created by

๐Ÿ‡ฆ๐Ÿ‡บAustralia larowlan ๐Ÿ‡ฆ๐Ÿ‡บ๐Ÿ.au GMT+10

Live updates comments and jobs are added and updated live.
  • VDC

    Related to the Views in Drupal Core initiative.

  • Novice

    It would make a good project for someone who is new to the Drupal contribution process. It's preferred over Newbie.

  • Needs change record

    A change record needs to be drafted before an issue is committed. Note: Change records used to be called change notifications.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States smustgrave

    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.

  • Status changed to Needs work over 1 year ago
  • ๐Ÿ‡ฌ๐Ÿ‡งUnited Kingdom alexpott ๐Ÿ‡ช๐Ÿ‡บ๐ŸŒ

    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 :)

  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia sahil.goyal

    sahil.goyal โ†’ made their first commit to this issueโ€™s fork.

  • last update about 1 year ago
    29,283 pass
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia sahil.goyal

    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.

  • Status changed to Needs review about 1 year ago
  • Status changed to Needs work about 1 year ago
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States smustgrave

    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.

Production build 0.69.0 2024