Active
Project:
Relation Wizard UI
Version:
7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
15 Sep 2012 at 21:00 UTC
Updated:
20 Sep 2012 at 21:16 UTC
Short version:
template: "relation_wizard_ui.module"
function: "_relation_wizard_ui_datatable_ajax"
statement: $rows = array_merge($rows, $entity_manager->getRows($entity_type, $iDisplayStart, $iDisplayLength, $bundles, $sSearch));
error: Call to a member function getRows() on a non-object, relation_wizard_ui.module, line 732
Really long version:
When I try to create a Vehicle<->Airport2Zone relationship with the relationship wizard ui, I get
DataTables warning (table id = 'Datatables_Table_0'): DataTable warning: JSON data from server could not be parsed. This is caused by a JSON formatting error.
Checking the ajax call in relation-wizard-ui.js, I see that the calls are:
Vehicle<->Zone:
/relation_wizard_ui/datatable_ajax?rel_type=airport_zone&rel_direction=target
Vehicle<->Airport2Zone:
/relation_wizard_ui/datatable_ajax?rel_type=vehicle_airport2zone&rel_direction=target
Running the code by hand yields the following (all of the variables below are from inside template "relation_wizard_ui.module", function "_relation_wizard_ui_datatable_ajax":
// THIS WORKS
Passing in:
$type = 'airport_zone'; // this is a "content type<->content type" relationship
$direction = 'target';
$iDisplayStart = NULL;
$iDisplayLength = 5;
$sSearch = NULL;
$relation_type
--------------------------------------------
stdClass::__set_state(array(
'relation_type' => 'airport_zone',
'label' => 'Airport <-> Zone',
'reverse_label' => 'Airport <-> Zone',
'directional' => '1',
'transitive' => '1',
'r_unique' => '1',
'min_arity' => '2',
'max_arity' => '2',
'table' => 'relation_type',
'type' => 'Normal',
'export_type' => 1,
'source_bundles' =>
array (
0 => 'node:airport_content',
),
'target_bundles' =>
array (
0 => 'node:zone_content',
),
'bundles_loaded' => true,
))
$entity_bundles
--------------------------------------------
array (
'node' =>
array (
0 => 'zone_content',
),
)
debug($entity_manager->getRows($entity_type, $iDisplayStart, $iDisplayLength, $bundles, $sSearch));
--------------------------------------------
array (
0 =>
array (
0 => 'Zone 1',
1 => 'node',
2 => 40,
),
1 =>
array (
0 => 'Zone 2',
1 => 'node',
2 => 41,
),
2 =>
array (
0 => 'Zone 3',
1 => 'node',
2 => 42,
),
3 =>
array (
0 => 'Zone 4',
1 => 'node',
2 => 43,
),
4 =>
array (
0 => 'Zone 5',
1 => 'node',
2 => 44,
),
)
When looking at individual elements of above debug:
$entity_type = 'node'
$iDisplayStart = NULL
$iDisplayLength = 5
$bundles = array ( 0 => 'zone_content', )
$sSearch = NULL
// THIS DOES NOT WORK
Passing in:
$type = 'vehicle_airport2zone'; // this is a "content type<->relationship" relationship
$direction = 'target';
$iDisplayStart = NULL;
$iDisplayLength = 5;
$sSearch = NULL;
$relation_type
--------------------------------------------
stdClass::__set_state(array(
'relation_type' => 'vehicle_airport2zone',
'label' => 'Vehicle<->Airport_Zone',
'reverse_label' => 'Vehicle<->Airport_Zone',
'directional' => '1',
'transitive' => '1',
'r_unique' => '1',
'min_arity' => '2',
'max_arity' => '2',
'table' => 'relation_type',
'type' => 'Normal',
'export_type' => 1,
'source_bundles' =>
array (
0 => 'node:vehicle_content',
),
'target_bundles' =>
array (
0 => 'relation:vehicle_airport_zone',
),
'bundles_loaded' => true,
))
$entity_bundles
--------------------------------------------
array (
'relation' =>
array (
0 => 'vehicle_airport_zone',
),
)
debug($entity_manager->getRows($entity_type, $iDisplayStart, $iDisplayLength, $bundles, $sSearch));
--------------------------------------------
ERROR: Call to a member function getRows() on a non-object, relation_wizard_ui.module, line 732
When looking at individual elements:
$entity_type = 'relation'
$iDisplayStart = NULL
$iDisplayLength = 5
$bundles = array ( 0 => 'vehicle_airport_zone', )
$sSearch = NULL
Comments
Comment #1
jmoyles commentedTo work around this issue, made the following changes:
To allow the "relation" entity_type to work in the relation entity factory builder, changed ./includes/RelationEntityFactory.inc as follows:
To allow a user friendly name for a relation instead of the relation ID, changed ./relation_wizard_ui.module as follows (NOTE: this is a quick and dirty hack - only tested for both endpoints as nodes):
To allow a relation to display properly on the listing page, changed ./relation_wizard_ui.module as follows (NOTE: this is a quick and dirty hack - only tested for both endpoints as nodes):
Comment #2
jmoyles commentedChanged status as per http://drupal.org/node/156119 guidelines.