Problem/Motivation

Follow up to #2949964: Add an EntityOwnerTrait to standardize the base field needed by EntityOwnerInterface.

The Workspace entity should use EntityOwnerTrait.

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Sam152 created an issue. See original summary.

Sam152’s picture

Sam152’s picture

Title: [PP-1] Convert the Workspace entity to use EntityOwnerInterface » [PP-1] Convert the Workspace entity to use EntityOwnerTrait
Issue summary: View changes
amateescu’s picture

Status: Active » Postponed
Issue tags: +Workflow Initiative
FileSize
3.26 KB

It's funny that #2949964: Add an EntityOwnerTrait to standardize the base field needed by EntityOwnerInterface was opened from a review of the initial workspace patch, but handling the workspace entity has been left to a followup :)

Anyway, once the parent issue lands, this patch should do it.

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

Drupal 8.6.0-alpha1 will be released the week of July 16, 2018, which means new developments and disruptive changes should now 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.

amateescu’s picture

Component: workspace.module » workspaces.module

Fix component following module rename.

Sam152’s picture

Title: [PP-1] Convert the Workspace entity to use EntityOwnerTrait » Convert the Workspace entity to use EntityOwnerTrait
Status: Postponed » Needs review
FileSize
3.12 KB
longwave’s picture

Status: Needs review » Reviewed & tested by the community

Looks good to me.

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

As an experimental module backporting to 8.6.x

Committed and pushed 69a3c90ce9 to 8.7.x and 1564d99234 to 8.6.x. Thanks!

diff --git a/core/modules/workspaces/src/Entity/Workspace.php b/core/modules/workspaces/src/Entity/Workspace.php
index 33649be4f5..5796b207bf 100644
--- a/core/modules/workspaces/src/Entity/Workspace.php
+++ b/core/modules/workspaces/src/Entity/Workspace.php
@@ -9,7 +9,6 @@
 use Drupal\Core\Field\BaseFieldDefinition;
 use Drupal\Core\StringTranslation\TranslatableMarkup;
 use Drupal\user\EntityOwnerTrait;
-use Drupal\user\UserInterface;
 use Drupal\workspaces\WorkspaceInterface;
 
 /**

Fixed unused use on commit.

  • alexpott committed 69a3c90 on 8.7.x
    Issue #2975957 by Sam152, amateescu: Convert the Workspace entity to use...

  • alexpott committed 1564d99 on 8.6.x
    Issue #2975957 by Sam152, amateescu: Convert the Workspace entity to use...
tacituseu’s picture

This introduced test failures on 8.6.x because #2949964: Add an EntityOwnerTrait to standardize the base field needed by EntityOwnerInterface wasn't backported:
https://www.drupal.org/pift-ci-job/1071807
https://www.drupal.org/pift-ci-job/1071809

Testing Drupal\Tests\config\Functional\ConfigImportAllTest
E                                                                   1 / 1 (100%)

Time: 1.17 minutes, Memory: 4.00MB

There was 1 error:

1) Drupal\Tests\config\Functional\ConfigImportAllTest::testInstallUninstall
PHPUnit\Framework\Exception: Fatal error: Trait 'Drupal\user\EntityOwnerTrait' not found in /var/www/html/core/modules/workspaces/src/Entity/Workspace.php on line 68
longwave’s picture

Priority: Normal » Critical
Status: Fixed » Reviewed & tested by the community

Yeah, this needs rolling back from 8.6.x as EntityOwnerTrait is a new feature in 8.7.x only.

alexpott’s picture

Priority: Critical » Normal
Status: Reviewed & tested by the community » Fixed

Fixed

  • alexpott committed 5d37cff on 8.6.x
    Revert "Issue #2975957 by Sam152, amateescu: Convert the Workspace...

Status: Fixed » Closed (fixed)

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