I want to create a view which will list the node titles which are in a specific queue.

In the fields I have added the node title,
In filter I have added the content in queue -> Yes
In relationship I have added entityqueue_relationship

But when I try to save the I view it gives me the following error.

Array
(
    [%type] => Notice
    [!message] => Undefined index: table
    [%function] => Drupal\views\Plugin\views\relationship\RelationshipPluginBase->calculateDependencies()
    [%file] => /[path to drupal]/core/modules/views/src/Plugin/views/relationship/RelationshipPluginBase.php
    [%line] => 181
)
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

hmdnawaz created an issue. See original summary.

amateescu’s picture

Status: Active » Postponed (maintainer needs more info)

This could have been caused by a similar problem with queues and Views (#2645060: Newly added entity queues are not getting listed under relationship in views). Can you please try again with the latest -dev version?

That fix should be available in a few hours in the 8.x-1.x-dev archive or right away if you're using a git checkout of the module repository.

hmdnawaz’s picture

Status: Postponed (maintainer needs more info) » Active

Downloaded the latest dev version and test with it but same problem exist.

Also tried the git clone --branch 8.x-1.x https://git.drupal.org/project/entityqueue.git as in versions control of the module there is only one branch for D8 which 8.x-1.x but same results

Array
(
    [%type] => Notice
    [!message] => Undefined index: table
    [%function] => Drupal\views\Plugin\views\relationship\RelationshipPluginBase->calculateDependencies()
    [%file] => /[path to drupal]/core/modules/views/src/Plugin/views/relationship/RelationshipPluginBase.php
    [%line] => 181
)
hmdnawaz’s picture

Issue summary: View changes
amateescu’s picture

Thanks for testing again. I tried to reproduce the problem and I can save a view without any errors..

Can you please try to debug a bit more locally? You can put a debug($table_data); in \Drupal\views\Plugin\views\relationship\RelationshipPluginBase::calculateDependencies() on line 180 (just before the return statement) and maybe post the output here.

And maybe export the view as a single config file and post it as an attachement here as well.

hmdnawaz’s picture

FileSize
5.56 KB

When I try to print_r($table_data) on line 180 before the return statement, it gives me an empty array.

And the exported view is attached.

amateescu’s picture

How about a print_r($this->definition['base'])? So we can at least find out what table data it's looking for :)

amateescu’s picture

      relationships: {  }

Oh wait, it seems that your view does not actually have a relationship to an entity queue...

That's also what I see locally in the UI after importing your exported config file.

hmdnawaz’s picture

The view does not have a relationship because when I add a relationship of entityqueue and then save the view, it can't get save instead it gives an error. therefore there is no relationship in my exported view.

And print_r($this->definition['base']) returns entity_subqueue__items

hmdnawaz’s picture

My drupal core version is 8.0.1

amateescu’s picture

Status: Active » Postponed

Ah, ok, I think I know what the problem is.

It's most likely this core issue #2477899: Multiple valued Base fields won't work in Views and it affects Entityqueue because 'items' is a base field with cardinality > 1.

So we need to fix both #2644088: DefaultTableMapping::getFieldTableName does not report table for fields with dedicated storage and #2477899: Multiple valued Base fields won't work in Views and then come back here and check again..

quindio’s picture

I am trying to replicate my view using a nodeque relationship
from my D6 into my D8 migration and I am having the same
problem when creating the view with an entityque relationship
I get a warning:
In order to sort by the queue position, you need to add the Entityqueue: Queue relationship on View: nodequeue_1 with display: default

Then I create a relationship and I get an error when I tried to save:
Notice: Undefined index: table in Drupal\views\Plugin\views\relationship\RelationshipPluginBase->calculateDependencies() (line 181 of /usr/share/nginx/html/drupal8012015/core/modules/views/src/Plugin/views/relationship/RelationshipPluginBase.php).

Where do I set the "with display: default" for the 1st warning?
Any ideas?

Thanks!!

amateescu’s picture

The first warning just says that you need to add the entityqueue relationship, the default display part is not really important :)

Is there any chance you can provide the exact steps that you did, something like: created content type X, added fields X and Y, created the view Z and configured it with options A, B, C, etc?

Without being able to reproduce the problem locally, I can't really help much more than this..

quindio’s picture

Hi Ameteescu,

I created an entityque name "Featured Video for Home Page"
for the content type "mobile app news" and a view name nodequeue_1
where I am trying to create the realationship

Perhaps, I am using entityque wrong. I have included 4 screenshots at this location:
entityque files
1- first is the entityque configuration "Edit_Entityque_page"
2- my mobile apps content type "mobile_apps_contenttype"
3- the nodequeue_1 views top part "nodequeue_1_view"
4- the nodequeue_1 views bottom part(sql) "nodequeue_1_view_bottom"

Thanks,

amateescu’s picture

Thanks for the additional info. It seems there are quite a few things configured in there so anything other than a full site export won't help me.

However, can you try to apply two patches to your Drupal installation and check if they solve the problem? The two patches are the ones from #2644088-32: DefaultTableMapping::getFieldTableName does not report table for fields with dedicated storage and #2477899-25: Multiple valued Base fields won't work in Views.

quindio’s picture

After patching with
#32

$ patch -p1 < ./modules/contrib/entityqueue/2644088-32.patch
patching file core/lib/Drupal/Core/Entity/Sql/DefaultTableMapping.php
patching file core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php
patching file core/modules/system/src/Tests/Entity/Update/UpdateApiEntityDefinitionUpdateTest.php
patching file core/tests/Drupal/KernelTests/Core/Entity/DefaultTableMappingIntegrationTest.php
patching file core/tests/Drupal/Tests/Core/Entity/Sql/SqlContentEntityStorageTest.php
 

and #25

$ patch -p1 < ./modules/contrib/entityqueue/2477899-25.patch
patching file core/modules/views/src/EntityViewsData.php

I added the RELATIONSHIP to teh view and then I tried to save and I got this error:

$inputNotice: Undefined index: table in Drupal\views\Plugin\views\relationship\RelationshipPluginBase->calculateDependencies() (line 181 of /usr/share/nginx/html/drupal8012015/core/modules/views/src/Plugin/views/relationship/RelationshipPluginBase.php). =>

→$input array(40)

     	file	args
    39: Drupal\views\Plugin\views\relationship\RelationshipPluginBase->calculateDependencies()	

    "core/modules/views/src/Plugin/views/relationship/RelationshipPluginBase.php:181"
    	
    38: Drupal\entityqueue\Plugin\views\relationship\EntityQueueRelationship->calculateDependencies()	

    "modules/contrib/entityqueue/src/Plugin/views/relationship/EntityQueueRelationship.php:73"
    	
    37: Drupal\views\Plugin\views\display\DisplayPluginBase->calculatePluginDependencies()	

    "core/lib/Drupal/Core/Plug

Thanks

andypost’s picture

got the problem with export view, module dependency is exported as "null" instead of entityqueue

andypost’s picture

Also testing that under pgsql is sad, but probably needs followup

SQLSTATE[42883]: Undefined function: 7 ERROR: operator does not exist: bigint = character varying LINE 6: ...eue__items_node_field_data ON node_field_data.nid = entity_s... ^ HINT: No operator matches the given name and argument type(s). You might need to add explicit type casts.: SELECT COUNT(*) AS expression FROM (SELECT 1 AS expression FROM {node_field_data} node_field_data LEFT JOIN {entity_subqueue__items} entity_subqueue__items_node_field_data ON node_field_data.nid = entity_subqueue__items_node_field_data.items_target_id AND entity_subqueue__items_node_field_data.bundle = :views_join_condition_0 WHERE (( (node_field_data.status = :db_condition_placeholder_0) ))) subquery; Array ( [:db_condition_placeholder_0] => 1 [:views_join_condition_0] => test_queue )

mikedotexe’s picture

I'm also experiencing #17.
This causes the configuration for the view to not be able to import using configuration import.
If I delete the exported line:

...
module:
  - null (this line)
...

then everything works great.

mikedotexe’s picture

Here's an update on some step debugging for this issue.
It seems like it's a caching issue.

I'm comparing this to a required relationship with a taxonomy term.

We end up in core/modules/views/src/Plugin/views/relationship/RelationshipPluginBase.php

  public function calculateDependencies() {
    ...
    $table_data = $this->getViewsData()->get($this->definition['base']); // <-- good place to set breakpoint
    return [
      'module' => [$table_data['table']['provider']],
    ];
  }

Step debugging from there brings us to core/modules/views/src/ViewsData.php

the cacheGet call below always returns an empty $data->data

  public function get($key = NULL) {
    if ($key) {
      if (!isset($this->storage[$key])) {
        ...
        if ($data = $this->cacheGet($cid)) {
          $this->storage[$key] = $data->data; // <-- always empty
          $from_cache = TRUE;
        }

I'm afraid I'm not familiar enough with Drupal 8 caching to understand where this is being set.

Hope this helps maintainers of this module.

afoster’s picture

Confirming I have the same issues from @andypost and @mikedotexe are reporting in #17, #19. Any view using entityqueue relationship and sorting exports a null dependency. Tested in Drupal 8.05 and on simplytest.me which is running 8.06-dev. Also tested Entity Queue alpha-4 and dev.

I'm too haven't managed to track down the issue, but am putting in some errors here incase others are having the issue.

Using Import in the UI

The configuration cannot be imported because it failed validation for the following reasons:
Configuration views.view.test_view depends on the module that will not be installed after import.

Using Drush CIM
Drupal\Core\Config\ConfigImporterException: There were errors validating the config synchronization. in [error]
Drupal\Core\Config\ConfigImporter->validate() (line 730 of /website/core/lib/Drupal/Core/Config/ConfigImporter.php).
The import failed due for the following reasons: [error]
Configuration views.view.test_view depends on the module that will not be installed
after import.

Workaround: After Exporting delete the null line

uuid: 4c27fc66-59a1-4ca3-b4ef-7d899f23fe1c
langcode: en
status: true
dependencies:
  config:
    - entityqueue.entity_queue.sort
    - node.type.test
  module:
    - null <<< DELETE THIS
    - entityqueue
    - node
    - user
andypost’s picture

Current workaround is to install Null module)

krlucas’s picture

Installing Null module doesn't help for me. drush cex still exports the view with

dependencies:
  ...
  module:
    - null

instead of

dependencies:
  ...
  module:
    - 'null'

Adding the quotes is no easier than deleting the line as in #21

chrisroane’s picture

I can confirm what krlucas said. Installing the null module doesn't fix it. Right now we have to remember to delete the null dependency when we run drush cex and it is really annoying........

balawang’s picture

As having similar issue when creating a install profile...
For what I've done to workaround this is to like #12 said, delete the dependencies - null line, and place the entityqueue.entity_queue.xxxxx.yml to config/optional folder together with views.view.xxxx.yml which has entityqueue relationship.

amateescu’s picture

Priority: Major » Critical
Status: Postponed » Needs review
FileSize
6.12 KB

I finally managed to reproduce this locally!

Thanks to #2644088: DefaultTableMapping::getFieldTableName does not report table for fields with dedicated storage, which got committed recently, I was able to also discover other problems with our views integration so here's a patch that should make everything work properly with Drupal 8.1.0 and beyond.

Can you please test it and let me know if an upgrade path is needed for existing views? Or if just a cache clear is enough to bring them on track?

amateescu’s picture

FileSize
6.2 KB

Rerolled the patch to take into account another patch that was just committed to 8.x-1.x (#2686623: Empty views cache when queue is updated).

For anyone who wants to test it, the patch in #26 should apply to 8.x-1.0-alpha4 and this one applies to the -dev release.

joachim’s picture

I applied the patch in #26 to my EntityQueue alpha4, did a drush cr, saved my view, and all seems to be working fine.

Previously, my view was actually saving, unlike the initial report here, but I was getting the same error message about RelationshipPluginBase->calculateDependencies().

BTW, between applying the patch and doing a cache clear, I got this fantastic crash when I tried looking at the view page:

Drupal\Core\Database\DatabaseExceptionWrapper: Exception in Resources[resources]: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'ON resource.id = . INNER JOIN entity_subqueue__items _resource ON entity_id = _r' at line 1: SELECT resource.id AS id, delta AS delta FROM {resource} resource INNER JOIN {} ON resource.id = . INNER JOIN {entity_subqueue__items} _resource ON entity_id = _resource.items_target_id ORDER BY delta ASC; Array ( ) in Drupal\views\Plugin\views\query\Sql->execute() (line 1457 of core/modules/views/src/Plugin/views/query/Sql.php).

That went away once caches were cleared :)

  • amateescu committed 2f46f3a on 8.x-1.x
    Issue #2643928 by amateescu: Can't save view with entity queue...

  • amateescu committed 5e8093b on 8.x-1.x
    Issue #2643928 followup: Provide an empty update function in order to...
amateescu’s picture

Status: Needs review » Fixed
FileSize
475 bytes

Thanks @joachim for testing :) I committed the patch from #27 along with this small followup that just provides an empty update function, for those who forget to clear the cache.

I'm going to hold off releasing alpha5 for a few days just so we can get a few more confirmations that we didn't break something else with this patch.

Grimreaper’s picture

Hello,

Thanks for the patches.

After drush updb, I resaved my view just in case. No more diff in Features that show a "null" module in dependencies.

Status: Fixed » Closed (fixed)

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

SanderJP’s picture

@amateescu when do you think alpha5 will be released? A few days turned into a few months ;)

ibuildit’s picture

confirming dev version works after I save the view again