Editor 1.6.1 PHP Options error
Editor 1.6.1 PHP Options error
Hi,
Since ver. 1.6.1 all of my tables stopped working because I used options. I tried one of the examples from the datatables.net, but it gives me the same error. Did I miss something when I updated the version? What can be the solution for this error?
I tried https://editor.datatables.net/examples/inline-editing/join.html
Fatal error: Uncaught exception 'ReflectionException' with message 'Class DataTables\Editor\Options does not have a constructor, so you cannot pass any constructor arguments' in /virtual/111.89.201.247/ssl/home/example/php/Ext/Ext.php:50
Stack trace:
newInstanceArgs(Array)">newInstanceArgs(Array)" href="#0-/virtual/111.89.201.247/ssl/home/example/php/Ext/Ext.php(50):-ReflectionClass->newInstanceArgs(Array)">0 /virtual/111.89.201.247/ssl/home/example/php/Ext/Ext.php(50): ReflectionClass->newInstanceArgs(Array)
1 /virtual/111.89.201.247/ssl/home/example/examples/php/join.php(26): DataTables\Ext::inst()
2 {main}
thrown in /virtual/111.89.201.247/ssl/home/example/php/Ext/Ext.php on line 50
// DataTables PHP library
include( "../../php/DataTables.php" );
// Alias Editor classes so they are easy to use
use
DataTables\Editor,
DataTables\Editor\Field,
DataTables\Editor\Format,
DataTables\Editor\Mjoin,
DataTables\Editor\Options,
DataTables\Editor\Upload,
DataTables\Editor\Validate;
/*
* Example PHP implementation used for the join.html example
*/
Editor::inst( $db, 'users' )
->field(
Field::inst( 'users.first_name' ),
Field::inst( 'users.last_name' ),
Field::inst( 'users.phone' ),
Field::inst( 'users.site' )
->options( Options::inst()
->table( 'sites' )
->value( 'id' )
->label( 'name' )
)
->validator( 'Validate::dbValues' ),
Field::inst( 'sites.name' )
)
->leftJoin( 'sites', 'sites.id', '=', 'users.site' )
->process($_POST)
->json();
This discussion has been closed.
Replies
Hi,
Could you let me know what version of PHP it is that you are using please? It sounds like something that newer PHP versions are more flexible with.
I suspect that the fix will be in Ext.php - the static
instmethod could be updated to be:Thanks,
Allan
Allan,
I ran into this problem today when upgrading to 1.6.1, and your change worked for me. I'm using PHP 5.3.3.
Thanks,
Jordan
Super - thanks! I'll have that committed and included in the 1.6.2 release.
Regards,
Allan
Hi Allan,
I'm running PHP Version 5.3.3.
Thank you for your support.
Problem solved!