When attempting to use the Contextual filter to select a specific Aggregator item, I get the following error:

Notice: Undefined index: highlighted in include() (line 109 of .../sites/all/themes/crcom/page.tpl.php).
Warning: Illegal offset type in SelectQuery->fields() (line 1330 of .../includes/database/select.inc).
PDOException: 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 'FROM aggregator_item aggregator_item WHERE (iid IN ('45'))' at line 1: SELECT FROM {aggregator_item} aggregator_item WHERE (iid IN (:db_condition_placeholder_0)) ; Array ( [:db_condition_placeholder_0] => 45 ) in views_handler_argument_aggregator_iid->title_query() (line 17 of .../sites/all/modules/views/modules/aggregator/views_handler_argument_aggregator_iid.inc).

It seems to be a problem with a lack of a table alias in the SQL query in the handler file (primarily because the fields() member is being invoked on the query object) and can be resolved by adding a table alias (e.g. 'i') like so:

    $result = db_select('aggregator_item', 'i')
      ->condition('iid', $this->value, 'IN')
      ->fields('i', array('title'))
      ->execute();

Comments

dawehner’s picture

This issue seems to be fixable. It would be really great if you could create a real patch, so it's much easier to realize what you try to do.

dawehner’s picture

Status: Active » Postponed (maintainer needs more info)

Also a way to reproduce the problem would be really handy

esmerel’s picture

Status: Postponed (maintainer needs more info) » Closed (cannot reproduce)
greenskunk’s picture

Status: Closed (cannot reproduce) » Active
StatusFileSize
new151.86 KB
new270.11 KB

Easily reproduced this issue.
See the two attached screenshots.

  1. Create a View of Aggregator Items
  2. Create a Contextual Filter (formerly known as Arguments in Drupal 6) that filters Aggregator: Item ID

Contextual Filter Settings:

WHEN THE FILTER VALUE IS NOT IN THE URL:

Display all results for the specified field

dawehner’s picture

Status: Active » Needs review
StatusFileSize
new815 bytes

Here is a patch for it, so it would be cool if you could try it out.

greenskunk’s picture

@dawehner Thank you. Tested and it works!

dawehner’s picture

Status: Needs review » Reviewed & tested by the community

So this seems to be RTBC.

dawehner’s picture

Project: Views (for Drupal 7) » Drupal core
Version: 7.x-3.x-dev » 8.x-dev
Component: Miscellaneous » aggregator.module
Status: Reviewed & tested by the community » Patch (to be ported)
Issue tags: +Needs backport to D8

Thanks for testing the patch! Committed and pushed to 7.x-3.x

zyxware’s picture

Issue summary: View changes
Status: Patch (to be ported) » Fixed

I tried to replicate this in a new install of D8 with latest dev but was not able to generate the notice

I created a new view of aggregator items with a page display
Added contextual filter Item Id
Added a feed and ran cron to fetch new items
Loaded page corresponding to aggregator items view.
Confirmed that PHP notices is set to be shown.
The notice shown in D7 is not seen in the page or in watchdog.

I am marking this as fixed in D8.

Status: Fixed » Closed (fixed)

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