Missing class MySQL?
Missing class MySQL?

Description of problem:
Invalid json response - this was working and now it's not working. Any idea what might have changed to cause MysqlQuery not to be found?
Error messages shown:
Warning: call_user_func() expects parameter 1 to be a valid callback, class 'DataTables\Database\Driver\MysqlQuery' not found in /vagrant/vendor/datatables.net/editor-php/Database.php on line 409
Call Stack:
0.0023 696392 1. {main}() /vagrant/api/budgets.php:0
0.0511 2643144 2. DataTables\Editor->process() /vagrant/api/budgets.php:91
0.0511 2643144 3. DataTables\Editor->_process() /vagrant/vendor/datatables.net/editor-php/Editor.php:703
0.0511 2644928 4. DataTables\Database->transaction() /vagrant/vendor/datatables.net/editor-php/Editor.php:971
0.0511 2645096 5. call_user_func() /vagrant/vendor/datatables.net/editor-php/Database.php:409
Debugger code (debug.datatables.net):
No issues found.
Link to test case:
<?php
require 'editor.php';
use
DataTables\Editor,
DataTables\Editor\Field,
DataTables\Editor\Options,
DataTables\Editor\Validate,
DataTables\Editor\ValidateOptions;
// Build our Editor instance and process the data coming from _POST
$editorInstance = Editor::inst( $db, 'consumer_budgets' )
->fields(
Field::inst( 'consumer_budgets.id as id' ),
Field::inst( 'consumer_budgets.consumer_id as consumer_id' )
->validator( Validate::notEmpty( ValidateOptions::inst()
->message( 'Please choose a consumer from the dropdown.' )
) )
->options( Options::inst()
->table( 'consumers' )
->value( 'id' )
->label( array('lname', 'fname') )
->render( function ( $row ) {
return $row['lname'].', '.$row['fname']. ' ' .$row['id'];
} )
->where( function ($q) {
$q->where( 'active', '1', '=' );
}
)
),
Field::inst( 'consumers.fname as fname' ),
Field::inst( 'consumers.lname as lname' ),
Field::inst( 'consumer_budgets.start_date as start_date' )
->validator( Validate::dateFormat( 'Y-m-d', ValidateOptions::inst()
->message( 'Enter date: m/d/yyyy' )
) )
->validator( Validate::notEmpty( ValidateOptions::inst()
->message('Please select a date.')
))
->validator( function ( $val, $data, $field, $host ) {
return $data["end_date"] < $val ?
"Start date must be before ". $data["end_date"] :
true;
} ),
Field::inst( 'consumer_budgets.end_date as end_date' )
->validator( Validate::dateFormat( 'Y-m-d', ValidateOptions::inst()
->message( 'Enter date: m/d/yyyy' )
) )
->validator( Validate::notEmpty( ValidateOptions::inst()
->message('Please select a date.')
))
->validator( function ( $val, $data, $field, $host ) {
return $data["start_date"] > $val ?
"End date must be after ". $data["start_date"] :
true;
} ),
Field::inst( 'consumer_budgets.program_id as program_id')
->validator( Validate::notEmpty( ValidateOptions::inst()
->message( 'Please choose a program from the dropdown.' )
) )
->options( Options::inst()
->table( 'programs' )
->value( 'id' )
->label( array('id','description'))
->where( function ($q) {
$q->where( 'programs.active', '1', '=' );
}
)
),
Field::inst('programs.description'),
Field::inst( 'consumer_budgets.overall_budget_id as overall_budget_id' ),
Field::inst( 'consumer_budgets.hours_allocated as hours_allocated' )
->validator( Validate::notEmpty( ValidateOptions::inst()
->message( 'Please enter a number of hours allocated.' )
) )
->validator( Validate::numeric() ),
Field::inst('consumer_budgets.annual_dollars as annual_dollars'),
Field::inst('consumer_budgets.hours_per_week as hours_per_week'),
Field::inst('consumer_budgets.weeks_per_year as weeks_per_year'),
Field::inst('consumer_budgets.provider as provider'),
Field::inst( 'consumers.active as active' )
)
->leftJoin( 'consumers', 'consumers.id', '=', 'consumer_budgets.consumer_id' )
->leftJoin( 'programs', 'programs.id', '=', 'consumer_budgets.program_id')
->where( function ( $q ) {
$q
->where( 'consumers.active', 1 )
// ->and_where( 'consumer_budgets.end_date', 'DATE(NOW())', '>', false )
;
} )
->process( $_POST )
->debug(true)
->json();
This question has an accepted answers - jump to answer
Answers
I guess the key question is: what changed? Have you updated the server's software, moved files around or something else?
Is the
Database/Driver/MysqlQuery.php
file actually there on the file system? Or perhaps theconfig.php
file has changed? Can you show me that (removing the user / pass).Allan
I deleted and put back my database and everything is working again...thanks for the help!