Comments

dawehner’s picture

Status: Active » Needs review
StatusFileSize
new18.9 KB

Not sure whether this is the right location.

Status: Needs review » Needs work

The last submitted patch, drupal-1962234-1.patch, failed testing.

dawehner’s picture

Status: Needs work » Needs review
StatusFileSize
new19.21 KB

I think putting it into the ViewsDataCache makes sense.

Status: Needs review » Needs work

The last submitted patch, drupal-1962234-3.patch, failed testing.

dawehner’s picture

Status: Needs work » Needs review
StatusFileSize
new19.61 KB

Let's see.

Status: Needs review » Needs work

The last submitted patch, drupal-1962234-5.patch, failed testing.

dawehner’s picture

Status: Needs work » Needs review
StatusFileSize
new936 bytes
new18.7 KB

Doh!

tim.plunkett’s picture

Looks good overall.

+++ b/core/modules/views/lib/Drupal/views/Plugin/views/relationship/GroupwiseMax.phpundefined
@@ -11,6 +11,7 @@
+use Drupal\views_ui\ViewFormControllerBase;

+++ b/core/modules/views/lib/Drupal/views/Plugin/views/wizard/WizardPluginBase.phpundefined
@@ -10,6 +10,7 @@
+use Drupal\views_ui\ViewFormControllerBase;

+++ b/core/modules/views/lib/Drupal/views/Tests/ViewsDataTest.phpundefined
@@ -7,6 +7,9 @@
+use Drupal\views_ui\ViewFormControllerBase;

+++ b/core/modules/views/views_ui/lib/Drupal/views_ui/Form/Ajax/AddItem.phpundefined
@@ -9,6 +9,8 @@
+use Drupal\views_ui\ViewFormControllerBase;

+++ b/core/modules/views/views_ui/lib/Drupal/views_ui/Form/Ajax/ConfigItem.phpundefined
@@ -10,6 +10,7 @@
+use Drupal\views_ui\ViewFormControllerBase;

+++ b/core/modules/views/views_ui/lib/Drupal/views_ui/ViewFormControllerBase.phpundefined
@@ -9,6 +9,7 @@
+use Drupal\views\Views;

Why is this added? Looks like PHPStorm might have gotten ahead of itself? :)

+++ b/core/modules/views/lib/Drupal/views/ViewsDataCache.phpundefined
@@ -268,6 +268,155 @@ public function fetchBaseTables() {
     return $tables;
   }
 
+
+
+  /**
+   * Fetch a list of all fields available for a given base type.

Extra blank lines.

+++ b/core/modules/views/lib/Drupal/views/ViewsDataCache.phpundefined
@@ -268,6 +268,155 @@ public function fetchBaseTables() {
+      uasort($strings, array('self', 'fetchedFieldSort'));
...
+      uasort($fields[$base][$type], array('self', 'fetchedFieldSort'));

Should be static, not self. Or I think you can do array($this, 'fetchedFieldSort'), not sure if that's better or worse?

dawehner’s picture

StatusFileSize
new4.23 KB
new17.24 KB

Yeah this happens if you a) are lazy and use phpstorm and b) you are lazy and don't review the patch before uploading.

damiankloip’s picture

Status: Needs review » Needs work
StatusFileSize
new17.29 KB

I rerolled anyway, but have a couple of points.

+++ b/core/modules/views/lib/Drupal/views/Tests/ViewsDataTest.phpundefined
@@ -216,7 +218,7 @@ public function testViewsFetchFields() {
+      $fields = Views::viewsData()->fetchFields('views_test_data', $handler_type);

Should we use the Views class here? or just get it form the container? I'm not sure.

+++ b/core/modules/views/lib/Drupal/views/ViewsDataCache.phpundefined
@@ -269,6 +269,153 @@ public function fetchBaseTables() {
+   * Fetch a list of all fields available for a given base type.

Fetches (I know it's just moving it, but might as well!)

+++ b/core/modules/views/lib/Drupal/views/ViewsDataCache.phpundefined
@@ -269,6 +269,153 @@ public function fetchBaseTables() {
+    static $fields = array();

Can't we just store this as a property on the class and do away with this static?

dawehner’s picture

Status: Needs work » Needs review
StatusFileSize
new12.99 KB
new19.17 KB

Created a views_data_helper service.

To be honest, I would like to have a total different naming, but i'm not sure about a better naming. Any suggestions?

Bojhan’s picture

dawehner’s picture

Issue tags: -VDC

#11: drupal-1962234-11.patch queued for re-testing.

Status: Needs review » Needs work
Issue tags: +VDC

The last submitted patch, drupal-1962234-11.patch, failed testing.

dawehner’s picture

Status: Needs work » Needs review
StatusFileSize
new19.1 KB

I still don't really like the different names, but at least rerole the patch.

dawehner’s picture

#15: drupal-1962234-15.patch queued for re-testing.

damiankloip’s picture

Status: Needs review » Needs work
+++ b/core/modules/views/views.services.ymlundefined
@@ -59,6 +59,9 @@ services:
+  views.views_data_helper:
+    class: Drupal\views\ViewsData

I think this class should be called ViewsDataHelper. If we are going the route of having separate classes. Then I would like to change the ViewsDataCache class to ViewsData as I think that is a better fit.

Otherwise, I think the patch looks good!

EDIT: #1989806: Rename ViewsDataCache to ViewsData is related.

damiankloip’s picture

Status: Needs work » Needs review
StatusFileSize
new2.46 KB
new19.08 KB

So we could make this ViewsDatHelper then both service names will be consistent with their class, win :) (IMO)

Status: Needs review » Needs work

The last submitted patch, 1962234-18.patch, failed testing.

damiankloip’s picture

Status: Needs work » Needs review
StatusFileSize
new19.12 KB

Sorry, getting ahead of myself.

dawehner’s picture

Two minor bits.

+++ b/core/modules/views/lib/Drupal/views/Tests/ViewsDataTest.phpundefined
@@ -7,8 +7,10 @@
+

ups

+++ b/core/modules/views/lib/Drupal/views/Tests/ViewsDataTest.phpundefined
@@ -7,8 +7,10 @@
+use Drupal\views\Views;

I don't think we use that here.

+++ b/core/modules/views/lib/Drupal/views/Views.phpundefined
@@ -25,6 +25,16 @@ public static function viewsData() {
+   * @return \Drupal\views\ViewsData

This should link to ViewsDataHelper

+++ b/core/modules/views/lib/Drupal/views/ViewsDataHelper.phpundefined
@@ -0,0 +1,186 @@
+   * @var \Drupal\views\ViewsDatacache

Should be ViewsDataCache

damiankloip’s picture

StatusFileSize
new18.88 KB

Here is a reroll, with comments above.

dawehner’s picture

Status: Needs review » Reviewed & tested by the community

Awesome!

alexpott’s picture

Status: Reviewed & tested by the community » Needs work
+++ b/core/modules/views/lib/Drupal/views/ViewsDataHelper.phpundefined
@@ -0,0 +1,186 @@
+    $a_group = drupal_strtolower($a['group']);
+    $b_group = drupal_strtolower($b['group']);
...
+    $a_title = drupal_strtolower($a['title']);
+    $b_title = drupal_strtolower($b['title']);

How about using Unicode::strtolower() :)

damiankloip’s picture

Status: Needs work » Needs review
StatusFileSize
new1.15 KB
new18.93 KB

How about that :)

dawehner’s picture

+++ b/core/modules/views/lib/Drupal/views/ViewsDataHelper.phpundefined
@@ -0,0 +1,188 @@
+                    $strings[$field][$key][$string] = t("Error: missing @component", array('@component' => $string));

Just wondering whether we actually should use String::format instead as it's kind of an exception, which also don't have an translation.

damiankloip’s picture

StatusFileSize
new985 bytes
new18.98 KB

I guess if we don't need this to be t() then we might as well.

damiankloip’s picture

Title: Move views_fetch_fields into a autoloadable class » Move views_fetch_fields into an autoloadable class
dawehner’s picture

Component: views_ui.module » views.module
Status: Needs review » Reviewed & tested by the community

Thank you very much.

alexpott’s picture

Status: Reviewed & tested by the community » Needs work

Hmmm... the $this->fields property is never set or used so in effect you've removed the static caching...

dawehner’s picture

Status: Needs work » Needs review
StatusFileSize
new11.93 KB
new28.18 KB

Wow I realized that these specific tests are currently totally break, due to $expected_keys = array_walk(), which returns TRUE/FALSE, all the time.

Here are the converted tests to phpunit with an mock object that ensures that the result is cached.

Status: Needs review » Needs work

The last submitted patch, vdc-1962234-31.patch, failed testing.

dawehner’s picture

Status: Needs work » Needs review
StatusFileSize
new982 bytes
new28.85 KB
damiankloip’s picture

Issue tags: -VDC

#33: vdc-1962234-33.patch queued for re-testing.

Status: Needs review » Needs work

The last submitted patch, vdc-1962234-33.patch, failed testing.

damiankloip’s picture

Status: Needs work » Needs review
Issue tags: +VDC

#33: vdc-1962234-33.patch queued for re-testing.

damiankloip’s picture

Status: Needs review » Reviewed & tested by the community

Patch is good, tests look great.

alexpott’s picture

Status: Reviewed & tested by the community » Needs work

We still have two references to views_fetch_fields in comments...

dawehner’s picture

Status: Needs work » Needs review
StatusFileSize
new1.58 KB
new29.37 KB

Oh you are right. Thank you for that catch.

tim.plunkett’s picture

Status: Needs review » Reviewed & tested by the community

Confirmed that views_fetch_fields is well and truly gone now.

Status: Reviewed & tested by the community » Needs work

The last submitted patch, vdc-1962234-39.patch, failed testing.

alexpott’s picture

Status: Needs work » Needs review
StatusFileSize
new29.43 KB
new698 bytes
damiankloip’s picture

Status: Needs review » Reviewed & tested by the community

Yes, I added those :) looks good.

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Committed b15e921 and pushed to 8.x. Thanks!

Status: Fixed » Closed (fixed)

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

xjm’s picture

Title: Move views_fetch_fields into an autoloadable class » [Change notice] Move views_fetch_fields into an autoloadable class
Project: Drupal core » Views (for Drupal 7)
Version: 8.x-dev » 8.x-3.x-dev
Component: views.module » Code
Status: Closed (fixed) » Active
Issue tags: +Needs change record
chris matthews’s picture

Project: Views (for Drupal 7) » Drupal core
Version: 8.x-3.x-dev » 8.7.x-dev
Component: Code » views.module
Issue summary: View changes

For more information as to why this issue was moved to the Drupal core project, please see issue #3030347: Plan to clean process issue queue

chris matthews’s picture

Project: Drupal core » Views (for Drupal 7)
Version: 8.7.x-dev » 7.x-3.x-dev
Component: views.module » Code
Status: Active » Closed (outdated)

Moving back to the contributed Views issue queue and closing as outdated per https://www.drupal.org/project/views/issues/3030347#comment-13023447