Closed (outdated)
Project:
Feeds
Version:
6.x-1.0-beta3
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
8 Dec 2009 at 16:20 UTC
Updated:
16 Jun 2016 at 20:44 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
dagmarPlease, can you export your view?
Comment #2
tesliana commented$view = new view;
$view->name = 'fs';
$view->description = 'fs';
$view->tag = '';
$view->view_php = '';
$view->base_table = 'feeds_source';
$view->is_cacheable = FALSE;
$view->api_version = 2;
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
$handler = $view->new_display('default', 'Defaults', 'default');
$handler->override_option('fields', array(
'feed_nid' => array(
'label' => 'Feed node id',
'alter' => array(
'alter_text' => 0,
'text' => '',
'make_link' => 0,
'path' => '',
'link_class' => '',
'alt' => '',
'prefix' => '',
'suffix' => '',
'target' => '',
'help' => '',
'trim' => 0,
'max_length' => '',
'word_boundary' => 1,
'ellipsis' => 1,
'strip_tags' => 0,
'html' => 0,
),
'empty' => '',
'hide_empty' => 0,
'empty_zero' => 0,
'set_precision' => FALSE,
'precision' => 0,
'decimal' => '.',
'separator' => ',',
'prefix' => '',
'suffix' => '',
'exclude' => 0,
'id' => 'feed_nid',
'table' => 'feeds_source',
'field' => 'feed_nid',
'relationship' => 'none',
),
'config' => array(
'label' => 'Source',
'alter' => array(
'alter_text' => FALSE,
'text' => '',
'make_link' => FALSE,
'path' => '',
'alt' => '',
'link_class' => '',
'prefix' => '',
'suffix' => '',
'target' => '',
'trim' => FALSE,
'max_length' => '',
'word_boundary' => TRUE,
'ellipsis' => TRUE,
'strip_tags' => FALSE,
'html' => FALSE,
),
'empty' => '',
'hide_empty' => 0,
'empty_zero' => 0,
'exclude' => 0,
'id' => 'config',
'table' => 'feeds_source',
'field' => 'config',
'relationship' => 'none',
),
'nothing' => array(
'label' => 'Custom text',
'alter' => array(
'text' => '',
'make_link' => 0,
'path' => '',
'link_class' => '',
'alt' => '',
'prefix' => '',
'suffix' => '',
'target' => '',
'help' => '',
'trim' => 0,
'max_length' => '',
'word_boundary' => 1,
'ellipsis' => 1,
'strip_tags' => 0,
'html' => 0,
),
'empty' => '',
'hide_empty' => 0,
'empty_zero' => 0,
'exclude' => 0,
'id' => 'nothing',
'table' => 'views',
'field' => 'nothing',
'relationship' => 'none',
),
'counter' => array(
'label' => 'View result counter',
'alter' => array(
'alter_text' => 0,
'text' => '',
'make_link' => 0,
'path' => '',
'link_class' => '',
'alt' => '',
'prefix' => '',
'suffix' => '',
'target' => '',
'help' => '',
'trim' => 0,
'max_length' => '',
'word_boundary' => 1,
'ellipsis' => 1,
'strip_tags' => 0,
'html' => 0,
),
'empty' => '',
'hide_empty' => 0,
'empty_zero' => 0,
'counter_start' => '1',
'exclude' => 0,
'id' => 'counter',
'table' => 'views',
'field' => 'counter',
'relationship' => 'none',
),
));
$handler->override_option('access', array(
'type' => 'none',
));
$handler->override_option('cache', array(
'type' => 'none',
));
$handler = $view->new_display('page', 'Page', 'page_1');
$handler->override_option('path', 'fs');
$handler->override_option('menu', array(
'type' => 'none',
'title' => '',
'description' => '',
'weight' => 0,
'name' => 'navigation',
));
$handler->override_option('tab_options', array(
'type' => 'none',
'title' => '',
'description' => '',
'weight' => 0,
));
Comment #3
dagmarSorry, you are using feeds to process your feeds, you should ask in this project.
Comment #4
alex_b commentedSupport request.
Comment #5
alex_b commentedClosing after prolonged period of inactivity.
Comment #6
seanberto commentedI'm getting this same error, though in line 96 of views/includes/query.inc now.
Using: Feeds 6.x-1.0-beta3 with Views 6.x-2.11. Occurs whenever a "Feeds source: Source Source" field is added to the view.
The problem is that Feeds is passing $base_field as an array, resulting in the illegal offset error.
Comment #7
seanberto commentedComment #8
seanberto commentedComment #9
alex_b commentedHm, how then are we going to reflect the fact that the primary key is two fields in feeds_source ?
Comment #10
seanberto commentedI'm not a pro with Views at all, but looking at: http://drupalcontrib.org/api/function/hook_views_data/6, I'm assuming that $data['feeds_source']['table']['base']['field'] is supposed to be the primary key of the table, right?
But the view seems to work just fine and doesn't throw any errors if I change line 23 in feeds/views/feeds.views.inc from:
to:
Am I missing something? (Probably ;) )
Comment #11
alex_b commentedYeah, that's clear. Thing is that I *assume* that base field needs to be unique but 'feed_nid' nor 'id' are unique, while ['feed_nid' | 'id'] is.
Comment #12
seanberto commentedAgain, not a pro, but I though that base field had to be the name of an actual column in your table. I'm curious to see what would happen if you just left base field blank, since you're not building any relationships that need the primary key.
Above my paygrade/skill level at this point. The change I made above works for my use case. I'm happy to test any patches that come from this. Thanks for all your work, alex_b, and please let me know how I can help!
Comment #13
alex_b commentedJust talked to some Views experts, here is what's going on:
Tables that should be Views base tables (feeds_source in this case) MUST have a primary key that consists of only one field, that's because base_field can be only one field and must be a PK.
This means that in order to fix this issue, we need to add an auto increment field (source_id I suggest) to the table and make it the PK instead of id | feed_nid. This is also the field that we will pass on to Views as base_field. #10 will break in cases where there is more then one $feed_nid. That's for instance when you use two standalone importers (not attached to nodes), both of their feed_nid would be 0.
Comment #14
seanberto commentedThat makes senses. Thanks for the follow up and detailed explanation. I'll keep following this ticket and will test any patches that result from this. Again, please let me know if there's more that I can do. Sorry that I'm not a good enough developer to lend a bigger hand.
-Sean
Comment #15
alex_b commentedIf you have any magic powers to send programmers this way, I'd appreciate it :-)
Comment #16
seanberto commentedWell, I should say that if all you need is a patch with a hook_update_N function written to add a new primary key field to the schema, I can do that...But I'm guessing this requires changing references to your current key all over the place. Right?
Comment #17
alex_b commentedThose references shouldn't be hard to track down, at least you could give it a try :)
Comment #18
seanberto commentedOkay. Will do. I'm on vacation next week (not that everyone on the forum needs to know...). The week after next I can this a try!
Comment #19
seanberto commentedOkay, here's my first stab at the patch. Seems to be working for me, but admittedly I haven't done a ton of testing.
Comment #20
cedarm commentedUpdated patch against 6.x CVS. Modified hook_schema() to match change. Also named the new pkey source_id instead of fid.
Is there a reason to add an index to replace the old primary key?
Comment #21
twistor commented