Editor leftJoin() with WHERE clause throwing error in Editor.php

Editor leftJoin() with WHERE clause throwing error in Editor.php

jhunter13jhunter13 Posts: 2Questions: 1Answers: 0
edited July 2014 in Editor

I've ran into a problem using a where clause while trying to join two tables. Once I comment out the where clause the table runs fine. I've tried multiple ways of writing the same join, but haven't been successful getting both to work at the same time. Any help would be much appreciated. Thanks in advance.

This is the error I receive back from the server side:

Fatal error: Call to a member function join() on a non-object in /js/DataTablesEditor/extensions/Editor/php/Editor/Editor.php on line 903

And here's how I'm defining the editor:

$editor = Editor::inst( $db, 'mtw_user_license' )
    ->field(
        Field::inst( 'mtw_user_license.fk_ul_user_id' )->set( false ),
        Field::inst( 'mtw_user_license.fk_ul_user_name' )->set( false ),
        Field::inst( 'mtw_user_license.ul_type' ),
        Field::inst( 'mtw_user_license.ul_school_year' ),
        Field::inst( 'mtw_user_license.ul_start_date' )
            ->set( false )
            ->getFormatter( function ($val) {
                return date( 'm/d/Y', strtotime($val));
            }),
        Field::inst( 'mtw_user_license.ul_status' ),
        Field::inst( 'mtw_user_license.ul_updated_at' )
            ->set( false )
            ->getFormatter( function ($val) {
                return date( 'm/d/Y', strtotime($val));
            }),
                    
        Field::inst( 'mtw_user.user_touched' )
            ->set( false )
            ->getFormatter( function ($val) {
                if($val===NULL)
                    return "";
                return date( 'm/d/Y', strtotime($val));
            }),
        Field::inst( 'mtw_user.user_name' )
            ->set( false ),
        Field::inst( 'mtw_user.user_fname' )
            ->set( false ),
        Field::inst( 'mtw_user.user_lname' )
            ->set( false ),
        Field::inst( 'mtw_user.user_home' )
            ->set( false )
    )
    ->where('mtw_user_license.ul_status', NULL)
    ->leftJoin( 'mtw_user', 'mtw_user.user_name', '=', 'mtw_user_license.fk_ul_user_name' );
            
//$editor->where('mtw_user_license.ul_status', NULL);

$data = $editor->pkey('pk_ul_id')
    ->process($_POST)
    ->data();

echo json_encode( $data );

Answers

  • allanallan Posts: 63,523Questions: 1Answers: 10,473 Site admin

    I think this is an error which has been corrected in the libraries and will be included in the 1.3.2 release (soon!). In the mean time, can you e-mail you the updated libraries using the e-mail address you used to register your DataTables account?

    Allan

  • jhunter13jhunter13 Posts: 2Questions: 1Answers: 0

    Yes, please do, thank you Allan!

This discussion has been closed.