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();
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | views-1294056-5.patch | 815 bytes | dawehner |
| #4 | 20130123-views-aggregator-settings.jpg | 270.11 KB | greenskunk |
| #4 | 20130123-error-views-aggregator.jpg | 151.86 KB | greenskunk |
Comments
Comment #1
dawehnerThis 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.
Comment #2
dawehnerAlso a way to reproduce the problem would be really handy
Comment #3
esmerel commentedComment #4
greenskunkEasily reproduced this issue.
See the two attached screenshots.
Contextual Filter Settings:
WHEN THE FILTER VALUE IS NOT IN THE URL:
Display all results for the specified field
Comment #5
dawehnerHere is a patch for it, so it would be cool if you could try it out.
Comment #6
greenskunk@dawehner Thank you. Tested and it works!
Comment #7
dawehnerSo this seems to be RTBC.
Comment #8
dawehnerThanks for testing the patch! Committed and pushed to 7.x-3.x
Comment #9
zyxware commentedI 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.