Hi, I am trying to join two tables and I've followed all the examples as closely as possible
but I keep getting this error when I run the file ('suspension_editor.php' in a browser); I am expecting to get a set of well formed JSON objects.
{"error":"SQLSTATE[42S22]: Column not found: 1054 Unknown column 'report_eligibility.emp_status' in 'field list'","data":[]}
That column does exist in my database. I've updated the config.php file to make sure I am pointing to the right db with the correct credentials. My only guess is that the leftJoin is not working.
Help is much appreciated! Thanks, Tom
Editor::inst( $db, suspension')
->fields(
Field::inst( 'report_eligibility.emp_status' )->validator( function ( $editor, $action, $data ) {
if ( $action !== Editor::ACTION_READ && $_SESSION['read_only'] ) {
return 'Cannot modify data';
}
} ),
Field::inst( 'suspension.emp_id' )->validator( function ( $editor, $action, $data ) {
if ( $action !== Editor::ACTION_READ && $_SESSION['read_only'] ) {
return 'Cannot modify data';
}
} ),
Field::inst( suspension.nuid' )->validator( function ( $editor, $action, $data ) {
if ( $action !== Editor::ACTION_READ && $_SESSION['read_only'] ) {
return 'Cannot modify data';
}
} ),
Field::inst( 'report_eligibility.last_name' ),
Field::inst( 'report_eligibility.first_name' ),
Field::inst( 'report_eligibility.region' ),
Field::inst( 'suspension.school_name' ),
Field::inst( 'suspension.course_name' ),
Field::inst('suspension.begin_date') ->validator( 'Validate::dateFormat', array(
"format" => Format::DATE_ISO_8601,
"message" => "Please enter a date in the format yyyy-mm-dd"
)),
Field::inst( suspension.end_date' )->validator( 'Validate::dateFormat', array(
"format" => Format::DATE_ISO_8601,
"message" => "Please enter a date in the format yyyy-mm-dd"
)),
Field::inst( 'suspension.notification_date' )->validator( 'Validate::dateFormat', array(
"format" => Format::DATE_ISO_8601,
"message" => "Please enter a date in the format yyyy-mm-dd"
)),
Field::inst( 'suspension.attempts' ),
Field::inst( 'suspension.comments' )
)
->leftJoin( 'report_eligibility', 'report_eligibility.nuid', '=', 'suspension.nuid' )
->process( $_POST )
->json();