Next part of #1976158: Rename entity storage/list/form/render "controllers" to handlers.

Not completely sure about everything in here, e.g. the Returns descriptions... seems like we need a new word for controller now...

Sandbox D8 Field API branch 2120871-entity-list-builder

CommentFileSizeAuthor
#87 2120871-entity-list-builder-87.patch94.07 KBBerdir
#83 2120871-entity-list-builder-83.patch94.06 KBandypost
#83 interdiff.txt621 bytesandypost
#82 2120871-entity-list-builder-82.patch94.05 KBBerdir
#80 2120871-entity-list-builder-80.patch94.44 KBandypost
#80 interdiff.txt639 bytesandypost
#78 2120871-entity-list-builder-78-interdiff.txt2.96 KBBerdir
#78 2120871-entity-list-builder-78.patch94.4 KBBerdir
#76 2120871-entity-list-builder-76-interdiff.txt19.46 KBBerdir
#76 2120871-entity-list-builder-76.patch94.38 KBBerdir
#75 2120871-entity-list-builder-75.patch91.55 KBBerdir
#73 2120871-entity-list-builder-73.patch91.43 KBandypost
#71 2120871-entity-list-builder-71.patch91.34 KBandypost
#65 2120871-entity-list-builder-65.patch91.6 KBandypost
#65 interdiff.txt810 bytesandypost
#61 drupal_2120871_61.patch90.96 KBXano
#57 2120871-entity-list-builder-57.patch90.53 KBandypost
#56 2120871-entity-list-builder-56.patch90.68 KBandypost
#56 interdiff.txt19.97 KBandypost
#52 2120871-entity-list-builder-52.patch87.65 KBandypost
#52 interdiff.txt2.4 KBandypost
#51 2120871-entity-list-builder-51.patch87.53 KBandypost
#49 2120871-entity-list-49.patch85.16 KBandypost
#49 interdiff.txt3.88 KBandypost
#48 2120871-entity-list-48.patch83.86 KBandypost
#48 interdiff.txt6.3 KBandypost
#44 2120871-entity-list-44.patch83.74 KBandypost
#44 interdiff.txt2.27 KBandypost
#42 2120871-entity-list-42.patch81.46 KBandypost
#42 interdiff.txt1.11 KBandypost
#39 2120871-entity-list-39.patch80.35 KBandypost
#39 interdiff.txt1.76 KBandypost
#38 2120871-entity-list-38.patch78.59 KBandypost
#33 2120871-entity-list-33.patch82.47 KBandypost
#30 2120871-entity-list-30.patch82.46 KBandypost
#30 interdiff.txt468 bytesandypost
#27 2120871-entity-list-27.patch82.92 KBandypost
#27 interdiff.txt442 bytesandypost
#25 entity-list-controller-2120871-25.patch82.89 KBandypost
#25 interdiff.txt21.92 KBandypost
#23 interdiff.txt1.18 KBamateescu
#23 entity-list-controller-2120871-23.patch77.53 KBamateescu
#16 entity-list-controller-2120871-16-interdiff.txt982 bytesBerdir
#16 entity-list-controller-2120871-16.patch77.57 KBBerdir
#14 entity-list-controller-2120871-14-interdiff.txt12.07 KBBerdir
#14 entity-list-controller-2120871-14.patch77.5 KBBerdir
#11 entity-list-controller-2120871-11.patch66.01 KBBerdir
#10 interdiff-2120871-6-9.txt7.17 KBvladan.me
#10 entity-list-controller-2120871-10.patch65.94 KBvladan.me
#6 entity-list-controller-2120871-6.patch67.33 KBBerdir
#3 entity-list-controller-2120871-3.patch66.73 KBBerdir
#3 entity-list-controller-2120871-3-interdiff.txt1.84 KBBerdir
#1 entity-list-controller-2120871-1.patch65.88 KBBerdir
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Berdir’s picture

Status: Active » Needs review
Issue tags: +Entity Field API
FileSize
65.88 KB

Here's the patch.

Status: Needs review » Needs work

The last submitted patch, entity-list-controller-2120871-1.patch, failed testing.

Berdir’s picture

Status: Needs work » Needs review
FileSize
1.84 KB
66.73 KB

This should fix the test fails. Broken phpunit test results are broken :(

Berdir’s picture

Status: Needs review » Needs work

The last submitted patch, 3: entity-list-controller-2120871-3.patch, failed testing.

Berdir’s picture

Issue summary: View changes
Status: Needs work » Needs review
Parent issue: » #1976158: Rename entity storage/list/form/render "controllers" to handlers
FileSize
67.33 KB

Re-roll.

Status: Needs review » Needs work

The last submitted patch, 6: entity-list-controller-2120871-6.patch, failed testing.

Berdir’s picture

Status: Needs work » Needs review
dawehner’s picture

  1. +++ b/core/lib/Drupal/Core/Config/Entity/ConfigEntityList.php
    @@ -2,21 +2,21 @@
    - * Definition of Drupal\Core\Config\Entity\ConfigEntityListController.
    + * Definition of Drupal\Core\Config\Entity\ConfigEntityList.
    

    Any reason we don't convert it to "Contains ... directly"

  2. +++ b/core/lib/Drupal/Core/Config/Entity/DraggableList.php
    @@ -2,7 +2,7 @@
    + * Contains Drupal\Core\Config\Entity\DraggableList.
    

    We could add the "\" prefix right now.

  3. +++ b/core/lib/Drupal/Core/Config/Entity/DraggableList.php
    @@ -13,9 +13,9 @@
    -abstract class DraggableListController extends ConfigEntityListController implements FormInterface {
    +abstract class DraggableList extends ConfigEntityList implements FormInterface {
    

    I wonder whether we should name it DraggableListBase given that it is a abstract class.

  4. +++ b/core/modules/block/custom_block/lib/Drupal/custom_block/CustomBlockTypeList.php
    @@ -29,7 +29,7 @@ public function getOperations(EntityInterface $entity) {
    -   * Overrides \Drupal\Core\Entity\EntityListController::buildHeader().
    
    @@ -38,7 +38,7 @@ public function buildHeader() {
    -   * Overrides \Drupal\Core\Entity\EntityListController::buildRow().
    +   * Overrides \Drupal\Core\Entity\EntityList::buildRow().
    

    {@inheritdoc}

  5. +++ b/core/modules/block/lib/Drupal/block/BlockList.php
    @@ -86,7 +85,7 @@ public static function createInstance(ContainerInterface $container, $entity_typ
    -   * Overrides \Drupal\Core\Config\Entity\ConfigEntityListController::load().
    +   * Overrides \Drupal\Core\Config\Entity\ConfigEntityList::load().
    
    @@ -107,7 +106,7 @@ public function load() {
    -   * Overrides \Drupal\Core\Entity\EntityListController::render().
    +   * Overrides \Drupal\Core\Entity\EntityList::render().
    

    {@inheritdoc}

  6. +++ b/core/tests/Drupal/Tests/Core/Entity/Enhancer/EntityRouteEnhancerTest.php
    @@ -55,12 +55,12 @@ public function testEnhancer() {
    -    // Set _entity_list and ensure that the entity list controller is set.
    +    // Set _entity_list and ensure that the entity list is set.
    ...
    -    $this->assertEquals('\Drupal\Core\Entity\Controller\EntityListController::listing', $defaults['_content'], 'The entity list controller was not set.');
    +    $this->assertEquals('\Drupal\Core\Entity\Controller\EntityListController::listing', $defaults['_content'], 'The entity list was not set.');
    

    This change is wrong, given that we do talk about the entity list controller (in the routing sense).

vladan.me’s picture

Re-roll and updated according to #9

Berdir’s picture

Another re-roll.

Berdir’s picture

Status: Needs review » Needs work

The last submitted patch, 11: entity-list-controller-2120871-11.patch, failed testing.

Berdir’s picture

Status: Needs work » Needs review
FileSize
77.5 KB
12.07 KB

Re-rolled, updated for config translation, user and node list controllers.

The last submitted patch, 14: entity-list-controller-2120871-14.patch, failed testing.

Berdir’s picture

The last submitted patch, 16: entity-list-controller-2120871-16.patch, failed testing.

longwave’s picture

The last submitted patch, 16: entity-list-controller-2120871-16.patch, failed testing.

dawehner’s picture

Berdir’s picture

amateescu’s picture

  1. +++ b/core/modules/contact/lib/Drupal/contact/CategoryList.php
    @@ -1,21 +1,21 @@
    + * Definition of Drupal\contact\CategoryList.
    
    +++ b/core/lib/Drupal/Core/Config/Entity/ConfigEntityList.php
    @@ -2,21 +2,21 @@
    + * Contains Drupal\Core\Config\Entity\ConfigEntityList.
    

    :)

  2. +++ b/core/modules/menu/menu.module
    @@ -100,12 +100,11 @@ function menu_menu() {
       return $items;
     }
    -
     /**
      * Implements hook_entity_info().
    

    I suppose this wasn't intended.

amateescu’s picture

It's not worth keeping up this patch any longer for those minor issues, I think it's RTBC.

amateescu’s picture

Status: Needs review » Reviewed & tested by the community

I meant this.

andypost’s picture

Status: Reviewed & tested by the community » Needs review
FileSize
21.92 KB
82.89 KB

The config translation controllers actually replaces list controllers so should be renamed as well

Block module controller should not be affected

Also patch cleans up some remains

Status: Needs review » Needs work

The last submitted patch, 25: entity-list-controller-2120871-25.patch, failed testing.

andypost’s picture

Status: Needs work » Needs review
FileSize
442 bytes
82.92 KB

Fixed UserList namespace

dawehner’s picture

Do we need to approve this API change?

  1. +++ b/core/lib/Drupal/Core/Entity/EntityControllerInterface.php
    @@ -7,7 +7,6 @@
     /**
    
    +++ b/core/lib/Drupal/Core/Entity/Controller/EntityViewController.php
    @@ -25,7 +25,7 @@ class EntityViewController implements ContainerInjectionInterface {
    diff --git a/core/lib/Drupal/Core/Entity/EntityControllerInterface.php b/core/lib/Drupal/Core/Entity/EntityControllerInterface.php
    
    diff --git a/core/lib/Drupal/Core/Entity/EntityControllerInterface.php b/core/lib/Drupal/Core/Entity/EntityControllerInterface.php
    index 79232c1..f78058a 100644
    
    index 79232c1..f78058a 100644
    --- a/core/lib/Drupal/Core/Entity/EntityControllerInterface.php
    
    --- a/core/lib/Drupal/Core/Entity/EntityControllerInterface.php
    +++ b/core/lib/Drupal/Core/Entity/EntityControllerInterface.php
    
    +++ b/core/lib/Drupal/Core/Entity/EntityControllerInterface.php
    +++ b/core/lib/Drupal/Core/Entity/EntityControllerInterface.php
    @@ -7,7 +7,6 @@
    
    @@ -7,7 +7,6 @@
     
     namespace Drupal\Core\Entity;
     
    -use Drupal\Core\Entity\EntityStorageControllerInterface;
     use Symfony\Component\DependencyInjection\ContainerInterface;
     
    

    This change is kind of out of scope ...

  2. +++ b/core/lib/Drupal/Core/Entity/EntityList.php
    @@ -161,7 +161,7 @@ public function buildHeader() {
    +   * @see \Drupal\Core\Entity\EntityList::render()
    
    @@ -145,7 +145,7 @@ public function getOperations(EntityInterface $entity) {
    +   * @see \Drupal\Core\Entity\EntityList::render()
    
    @@ -177,7 +177,7 @@ public function buildRow(EntityInterface $entity) {
    +   * @see \Drupal\Core\Entity\EntityList::render()
    

    I wonder whether we should just point to the interface?

amateescu’s picture

The parent meta (#1976158: Rename entity storage/list/form/render "controllers" to handlers) is already an approved API change.

andypost’s picture

1) my bad, fixed
2) suppose no, api.d.o will show this links on implementation pages so it easy to navigate

Status: Needs review » Needs work

The last submitted patch, 30: 2120871-entity-list-30.patch, failed testing.

andypost’s picture

Status: Needs work » Needs review

30: 2120871-entity-list-30.patch queued for re-testing.

andypost’s picture

FileSize
82.47 KB

re-roll

xjm’s picture

Issue tags: +beta target, +beta deadline
Berdir’s picture

33: 2120871-entity-list-33.patch queued for re-testing.

Status: Needs review » Needs work

The last submitted patch, 33: 2120871-entity-list-33.patch, failed testing.

The last submitted patch, 33: 2120871-entity-list-33.patch, failed testing.

andypost’s picture

Status: Needs work » Needs review
FileSize
78.59 KB

re-roll

andypost’s picture

FileSize
1.76 KB
80.35 KB

and new places

The last submitted patch, 38: 2120871-entity-list-38.patch, failed testing.

Status: Needs review » Needs work

The last submitted patch, 39: 2120871-entity-list-39.patch, failed testing.

andypost’s picture

Status: Needs work » Needs review
FileSize
1.11 KB
81.46 KB

fix broken test

Status: Needs review » Needs work

The last submitted patch, 42: 2120871-entity-list-42.patch, failed testing.

andypost’s picture

Status: Needs work » Needs review
FileSize
2.27 KB
83.74 KB

And search page entity

Berdir’s picture

Thanks for the re-rolls.

+++ b/core/lib/Drupal/Core/Entity/EntityManagerInterface.php
@@ -129,15 +129,15 @@ public function clearCachedDefinitions();
   public function getViewBuilder($entity_type);
 
   /**
-   * Creates a new list controller instance.
+   * Creates a new entity list.
    *
    * @param string $entity_type
-   *   The entity type for this list controller.
+   *   The entity type for this list.
    *
-   * @return \Drupal\Core\Entity\EntityListControllerInterface
-   *   A list controller instance.
+   * @return \Drupal\Core\Entity\EntityListInterface
+   *   An entity list instance.
    */
-  public function getListController($entity_type);

This still makes no sense at all, this is not a list, this is something that creates/builds a list.

Just like EntityAccess isn't an access, it is something that checks access.

-1 to not having a suffix/name for this thing. What about ListBuilder, matches well with ViewBuilder?

Xano’s picture

What about ListBuilder, matches well with ViewBuilder?

Without knowing I suggested pretty much the same thing on IRC, so +1 from me.

andypost’s picture

This listing builder is highly coupled to entity so prefix removal will confuse but maybe it makes sense to file new issue to decouple ListBuilderInterface and inherit EntitlyListBuilder from

andypost’s picture

I think better name for interface is EntityListBuilderInterface but implementations should have shorter names

andypost’s picture

Better doc-blocks

tim.plunkett’s picture

  1. +++ b/core/lib/Drupal/Core/Entity/Controller/EntityViewController.php
    @@ -25,7 +25,7 @@ class EntityViewController implements ContainerInjectionInterface {
    +   * Creates an EntityViewController object.
    

    This is still wrong.

  2. +++ b/core/lib/Drupal/Core/Entity/EntityList.php
    @@ -2,7 +2,7 @@
    + * Contains \Drupal\Core\Entity\EntityList.
    
    +++ b/core/includes/entity.inc
    @@ -468,19 +468,19 @@ function entity_get_form(EntityInterface $entity, $operation = 'default', array
    +    ->getList($entity_type);
    ...
    + * @deprecated Use \Drupal\Core\Entity\EntityManagerInterface::getList().
    ...
    + * Returns an entity list for a given entity type.
    

    This is a ListBuilder, not a list.

andypost’s picture

Re-roll patch to use Builder to replace Controller, just a questionable thing a config_translation controllers but they inherits from builder so changed too.

#50.1 This fixes wrong reference, so change is right.

andypost’s picture

A bit of clean-up for docs

The last submitted patch, 51: 2120871-entity-list-builder-51.patch, failed testing.

The last submitted patch, 51: 2120871-entity-list-builder-51.patch, failed testing.

Status: Needs review » Needs work

The last submitted patch, 52: 2120871-entity-list-builder-52.patch, failed testing.

andypost’s picture

Status: Needs work » Needs review
FileSize
19.97 KB
90.68 KB

Fix broken tests and unify doc-blocks

andypost’s picture

Berdir’s picture

+++ b/core/modules/action/lib/Drupal/action/ActionListBuilder.php
@@ -2,23 +2,25 @@
 /**
- * Provides a listing of Actions.
+ * Defines a class to build a listing of action entities.
+ *
+ * @see \Drupal\system\Entity\Action
+ * @see action_entity_info()

#1981858: Rename hook_entity_info/alter() to hook_entity_type_build/alter() will rename that function, let's make sure to update this when this or the other issue is committed.

Patch looks RTBC to me, but since ListBuilder was suggested by me, I'd like another sign off or two on that. @timplunkett maybe? and @yched/@fago?

tim.plunkett’s picture

Title: Rename EntityListController to EntityList » Rename EntityListController to EntityListBuilder
Status: Needs review » Reviewed & tested by the community

Looks good to me!

alexpott’s picture

Status: Reviewed & tested by the community » Needs work
Issue tags: +Needs reroll

2120871-entity-list-builder-57.patch no longer applies.

error: patch failed: core/modules/config_translation/config_translation.module:91
error: core/modules/config_translation/config_translation.module: patch does not apply
error: patch failed: core/modules/filter/lib/Drupal/filter/FilterFormatListController.php:2
error: core/modules/filter/lib/Drupal/filter/FilterFormatListController.php: patch does not apply
error: patch failed: core/modules/search/lib/Drupal/search/SearchPageListController.php:2
error: core/modules/search/lib/Drupal/search/SearchPageListController.php: patch does not apply

Xano’s picture

Status: Needs work » Needs review
FileSize
90.96 KB

Re-roll.

Xano’s picture

Issue tags: -Needs reroll

Status: Needs review » Needs work

The last submitted patch, 61: drupal_2120871_61.patch, failed testing.

The last submitted patch, 61: drupal_2120871_61.patch, failed testing.

andypost’s picture

Status: Needs work » Needs review
FileSize
810 bytes
91.6 KB

One more place to fix now

amateescu’s picture

Status: Needs review » Reviewed & tested by the community

Back to RTBC then.

xjm’s picture

Status: Reviewed & tested by the community » Needs work
Issue tags: +Needs change record

Draft change records are now required before commit. We don't do change records for every 8.x to 8.x BC break, but I think this change is big enough to require its own (very brief) change record for modules already using EntityListController.

The following two change records will also need very minor updates:
https://drupal.org/node/2089283
https://drupal.org/node/1799642

Once the change records are ready to go this can be set back to RTBC.

Berdir’s picture

I don't think we have a change notice already for the ViewBuilder (I just checked for existing ones and fixed a bunch of references, including some other fixes), do we want to do separate change notices for them or is one enough? Or add it to one of the existing large entity field api change notices, we already have multiple of those...

xjm’s picture

@berdir, can you link the issues and change records you're referring to? And maybe we can continue the discussion in the relevant other issue so we're not blocking this?

I think this issue only needs a very brief change record, like "EntiyListController renamed to EntityListBuilder" and two lines of text, just so there's a notification to the RSS feed and etc. 8.x to 8.x change records should probably usually follow that pattern.

Berdir’s picture

Discussed this a bit with @xjm, here's what we said would make sense:

- Start a new change notice "Entity controllers renamed"
- Reference the meta issue and all sub-issues (including this one)
- Describe the general concept of moving a way from the term "controller" for this, and using handler instead
- Also describe that different terms/suffixes are used for the different handlers, where appropiate
- Add a list of before/after class names (interface and base class, maybe an actual example like node) the annotation key and methods on EntityManagerInterface/EntityTypeInterface. Listing this all, this might be too much for a table, so maybe just add a heading ("EntityRenderController renamed to EntityViewBuilder") with descriptions below instead.
- Add a bold Note/Disclaimer that this is work in progress and not all renames have been executed. Maybe split the table in Implemented and Proposed renames?
- Include a complete example of before/after based on the current proposals. That should also help to understand the full picture.

I wanted to do this already but didn't, so if someone wants to start, please do so.

andypost’s picture

andypost’s picture

Added stub change record https://drupal.org/node/2200867 - the changes of that issue already there
https://drupal.org/node/2089283 & https://drupal.org/node/1799642 - should be updated after commit

andypost’s picture

Berdir’s picture

Issue tags: -Needs change record

Worked a bit on https://drupal.org/node/2200867.

It's not perfect yet (missing the other handlers, no example, as suggested in #70) but it should be good enough to unblock this issue.

However, I was wondering if we should also rename the list entity key to "list_builder", as we renamed "render" to "view_builder" and not just view. Right now, it's a bit inconsistent...

Berdir’s picture

Re-roll. Only serious conflict was in entity_list_controller(), which was not yet renamed, unused and deprecated, so I just dropped it. Other than that, just two conflicts on use statements.

Berdir’s picture

Ok, @timplunkett also said list_builder, so I renamed that and also the ListClass methods. Let's see if I got that right.

Status: Needs review » Needs work

The last submitted patch, 76: 2120871-entity-list-builder-76.patch, failed testing.

Berdir’s picture

Status: Needs work » Needs review
FileSize
94.4 KB
2.96 KB

Missed some setListClass() calls.

Status: Needs review » Needs work

The last submitted patch, 78: 2120871-entity-list-builder-78.patch, failed testing.

andypost’s picture

Fix for last broken test

Berdir’s picture

Berdir’s picture

Re-rolled, only conflicts where in Migrate and due to picture => responsive_image rename, and git took care of most of that, so no useful interdiff.

andypost’s picture

andypost’s picture

Issue summary: View changes

Added sandbox link

tim.plunkett’s picture

Status: Needs review » Reviewed & tested by the community

I like the added docs. Everything else is a 1:1 change.

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 83: 2120871-entity-list-builder-83.patch, failed testing.

Berdir’s picture

Status: Needs work » Needs review
FileSize
94.07 KB

Looks like andypost already pushed a merged version to the sandbox, this is the patch for that.

Status: Needs review » Needs work

The last submitted patch, 87: 2120871-entity-list-builder-87.patch, failed testing.

Berdir’s picture

Status: Needs work » Needs review
Berdir’s picture

Segmentation fault in NodeTranslationUiTest :(

andypost’s picture

Status: Needs review » Reviewed & tested by the community

yep, beck to rtbc

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Committed 5abaa5f and pushed to 8.x. Thanks!

  • Commit 5abaa5f on 8.x by alexpott:
    Issue #2120871 by andypost, Berdir, amateescu, vladan.me, Xano: Rename...

Status: Fixed » Closed (fixed)

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