Fatal error: Class 'Mjoin' not found in

Fatal error: Class 'Mjoin' not found in

cbasmadjiancbasmadjian Posts: 56Questions: 14Answers: 0
edited November 2016 in Free community support

I am receiving the error, "Fatal error: Class 'Mjoin' not found in...".

What I am trying to do is follow this blog article to get the feature of having one data table effect the other found here: https://datatables.net/blog/2016-03-25

According to that blog I should be doing this...

Editor::inst( $db, 'sites' )
    ->fields(
        Field::inst( 'id' )->set( false ),
        Field::inst( 'name' )->validator( 'Validate::notEmpty' )
    )
    ->join(
        Mjoin::inst( 'users' )
            ->link( 'sites.id', 'users.site' )
            ->fields(
                Field::inst( 'id' )
            )
    )
    ->process( $_POST )
    ->json();

What I am doing is this...

require_once(dirname(__DIR__) . '/DataTables-Editor/DataTables.php');
    use DataTables\Editor,
    DataTables\Editor\Field,
    DataTables\Editor\Format,
    DataTables\Editor\Join,
    DataTables\Editor\Upload,
    DataTables\Editor\Validate;

$sEditor = Editor::inst( $db, 'XXXXX', 'ID' );

        $sEditor->fields(
                Field::inst( 'XXXXX' ),
                Field::inst( 'XXXXX' ),
                Field::inst( 'XXXXX' ),
                Field::inst( 'XXXXX' ),
                Field::inst( 'XXXXX' ),
                Field::inst( 'XXXXX' ),
                Field::inst( 'XXXXX' ),
                Field::inst( 'XXXXX' ),
                Field::inst( 'XXXXX' ),
                Field::inst( 'XXXXX' )
            )
            ->join(
            Mjoin::inst( 'XXXXX' )
                ->link( 'XXXXX.ID', 'XXXXX.ID' )
                ->fields(
                    Field::inst( 'ID' ),
                    Field::inst( 'XXXXX' ),
                    Field::inst( 'XXXXX' ),
                    Field::inst( 'XXXXX' ),
                    Field::inst( 'XXXXX' ),
                    Field::inst( 'XXXXX' ),
                    Field::inst( 'XXXXX' ),
                    Field::inst( 'XXXXX' ),
                    Field::inst( 'XXXXX' ),
                    Field::inst( 'ForeignID' ),
                    Field::inst( 'XXXXX' )
                )
            )
            ->process( $_POST )
            ->json();

Not sure where I am going wrong? I even have confirmed this behavior in MS Edge.

Edited by Allan - Syntax highlighting. Details on how to highlight code using markdown can be found in this guide.

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,819Questions: 1Answers: 10,517 Site admin
    Answer ✓

    Could you add DataTables\Editor\Mjoin, into the use statement please. I think that should address the error.

    Allan

This discussion has been closed.