I'm not quite shure, if this is a bug, or if i'm doing something wrong.
In have a module that implements hook_views_data.
In hook_views_data i create a relationship:
In most examples the fields with the relation have unique names.
In my case this is not possible. This is how i define the relationship.
$data['sishandball_spiele']['mannschaft_1_id'] = array(
'title' => t('Mannschaft 1 ID'),
'help' => t('Mannschaft 1 ID help'),
'relationship' => array(
'base' => 'sishandball_mannschaften',
'field' => 'mannschaft_id',
'handler' => 'views_handler_relationship',
'label' => t('SIS Handball Mannschaft 1'),
),
When i add the relationship i get the follwing error:
Column not found: 1054 Unknown column 'sishandball_spiele.mannschaft_id' in 'on clause
This is the query created by views:
SELECT sishandball_spiele.datum AS sishandball_spiele_datum
FROM
{sishandball_spiele} sishandball_spiele
INNER JOIN {sishandball_mannschaften} sishandball_mannschaften_sishandball_spiele ON sishandball_spiele.mannschaft_id = sishandball_mannschaften_sishandball_spiele.mannschaft_id
As you can see the name mannschaft_1_id does not appear in the ON statement
If i change the line no 117 in views_handler_relationship.inc
from
$def['left_field'] = $this->real_field;
to
$def['left_field'] = $this->field
everything is working fine.
Comments
Comment #1
dawehnerFrom reading your error description you probably want to use
instead.