Hello

In the file views/includes/handlers.inc:1163 the sample code is incorrect.
The method views_join_complex::construct() signature in the sample require 4 arguments and 2 optional arguments,
but the views_handler_relationship::query(): never pass these arguments, views/handlers/views_handler_relationship.inc:111.

The right sample code is:

class views_join_complex extends views_join {
  // PHP 4 doesn't call constructors of the base class automatically from a
  // constructor of a derived class. It is your responsibility to propagate
  // the call to constructors upstream where appropriate.
  function construct($table = NULL, $left_table = NULL, $left_field = NULL, $field = NULL, $extra = array(), $type = 'LEFT') {
    parent::construct($table, $left_table, $left_field, $field, $extra, $type);
  }
 
  function join($table, &$query) {
    $output = parent::join($table, $query);
    $output .= "AND foo.bar = baz.boing";
    return $output;
  }
}
CommentFileSizeAuthor
#2 881060.patch1.08 KBbenoit.borrel
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

dawehner’s picture

can you create a patch? This would be cool

benoit.borrel’s picture

FileSize
1.08 KB

Here is the patch. Credit to Sweetchack.

dagmar’s picture

Assigned: Unassigned » dawehner
Status: Active » Needs review
dawehner’s picture

Status: Needs review » Reviewed & tested by the community

Looks fine, but this patch has to be rerolled for d7. (just a note)

merlinofchaos’s picture

Version: 6.x-2.x-dev » 7.x-3.x-dev
Status: Reviewed & tested by the community » Patch (to be ported)

Committed to D6 both 2.x and 3.x branches.

dawehner’s picture

Status: Patch (to be ported) » Fixed

Finally managed to convert it.

Status: Fixed » Closed (fixed)

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