Having issue with grocery crud enterprise 3 version while updating old version to new

Please see below error message after updating grocery crud enterprise to version 3

An uncaught Exception was encountered
Type: TypeError

Message: GroceryCrud\Core\State\StateAbstract::getConfigParameters(): Return value must be of type array, bool returned

Filename: /var/www/html/application/libraries/GroceryCrudEnterprise/grocery-crud/enterprise/src/GroceryCrud/Core/State/StateAbstract.php

Line Number: 81

Backtrace:

File: /var/www/html/application/libraries/GroceryCrudEnterprise/grocery-crud/enterprise/src/GroceryCrud/Core/State/MainState.php
Line: 64
Function: getConfigParameters

File: /var/www/html/application/libraries/GroceryCrudEnterprise/grocery-crud/enterprise/src/GroceryCrud/Core/State/MainState.php
Line: 41
Function: showList

File: /var/www/html/application/libraries/GroceryCrudEnterprise/grocery-crud/enterprise/src/GroceryCrud/Core/GroceryCrud.php
Line: 2867
Function: render

File: /var/www/html/application/controllers/Admin.php
Line: 4578
Function: render

File: /var/www/html/index.php
Line: 315
Function: require_once

Thank you

Hello @ondigit and welcome to our forums :hugs:

It seems that the configuration that you are passing is not getting passed correctly. Can you debug the $config variable that you are passing for example like this:

var_dump($config);
die;

Also can you give us more info? Are you using CodeIgniter version 4?

Regards
Johnny

Please see below screen after adding var_dump($config);

Also can you give us more info? Are you using CodeIgniter version 4?

==no we not using codeigniter 4 we are using codeigniter 3

now i getting my columns listing but now one error had occurred while inserting record we are not able to insert record like below see

Severity: Warning

Message: pg_query(): Query failed: ERROR: relation “demo_id_seq” does not exist LINE 1: SELECT CURRVAL(‘demo_id_seq’) as “currval” ^

Filename: Pgsql/Connection.php

we are able to update records now but not able to insert record

Hello @ondigit ,

That’s weird. Can you give an example from your Controller with the crud functions? For example something like this:

public function customers()
{
    $crud = $this->_getGroceryCrudEnterprise();
    $crud->setTable('customers');
    $crud->setSubject('Customer', 'Customers');
    $crud->columns(['customerName','country','state','addressLine1']);
    $output = $crud->render();
    $this->_example_output($output);
}

Yes sure i will provide ou the code:

public function index()
{
$schema_name=“da_client_master”;
$crud = $this->_getGroceryCrudEnterprise();
$crud->setDatabaseSchema($schema_name);
$crud->setTable(‘demo’);
$crud->setSubject(‘demo’, ‘demo’);
$crud->columns([‘firstname’,‘username’,‘email’]);
$crud->addFields([‘firstname’,‘username’,‘email’]);
$crud->editFields([‘firstname’,‘username’,‘email’]);
$output = $crud->render();
$this->_example_output($output);
}

and i will provide you the database table structure for demo table

Please looking into this on high prioprity

It has to do something with the nextval to be honest. Maybe this is an issue with the database schema? Can you insert a new record from an admin screen? For example from phpPgAdmin? Also from a quick google search I’ve found this (don’t know if this will help) currval Function in PostgreSQL complaining that "column does not exist" - Stack Overflow

It has to do something with the nextval to be honest. == not able to get what is the issue because fir update from system everything works ok

Maybe this is an issue with the database schema? == but how to check that because other database also having the same schema and it works fine there.

Can you insert a new record from an admin screen? For example from phpPgAdmin? == yes, i already tried this by inserting record through admin and from admin the record gets inserted correctly.

Also from a quick google search I’ve found this (don’t know if this will help) [currval Function in PostgreSQL complaining that “column does not exist” - Stack Overflow] (currval Function in PostgreSQL complaining that "column does not exist" - Stack Overflow) == this solution whch is provided in the email is not working i checked it.

Thank you

Hello @ondigit ,

Can you please add the database schema so I can also check locally?

For example something like this;

CREATE TABLE your_table_name (
    id SERIAL PRIMARY KEY,
    column1 datatype1,
    column2 datatype2
);

Quick question. Is there any reason that you don’t use SERIAL? Have you tried with SERIAL to see if this is working?
Regards
Johnny

Hello, i tried the example which you provided but while adding serial as datatype to to “id” column after executing query its shows integer as datatype don’t know why there is no serial datatype.

Is this due to PostgreSQL 15.3 or anything else not able to get

Hello @ondigit ,

I remember solving this sequence issue with the function setSequenceName | Grocery CRUD v3 maybe can you try with this function by adding your sequence name? For example:

$crud->setSequenceName('demo_id_seq');

Hello,

I tried using your setsequencename prperty but nothing seems to be changed. getting the following same error

A PHP Error was encountered

Severity: Warning

Message: pg_query(): Query failed: ERROR: relation “demo1_id_seq” does not exist LINE 1: SELECT CURRVAL(‘demo1_id_seq’) as “currval” ^

Filename: Pgsql/Connection.php

Line Number: 284

ok, then maybe it is a Grocery CRUD Enterprise bug? Maybe it is not working because you have a different schema?

Just to make sure, the name that you have is demo_id_seq and not demo1_id_seq that you are referring to. So maybe it was just a typo? If not then maybe something like this may work?

$crud->setSequenceName('da_client_master.demo_id_seq');

Hello,

Just to make sure, the name that you have is demo_id_seq and not demo1_id_seq that you are referring to. So maybe it was just a typo? If not then maybe something like this may work?
== the table name, schema name is correct only my table is demo1 and schema is da_client_master
there is no issue in that,

Hello @ondigit

The sequence name though seems that it is demo_id_seq . Can you maybe try the below:

$crud->setSequenceName('demo_id_seq');

Hello,

This $crud->setSequenceName(‘demo_id_seq’); will be used for “demo” table and this
$crud->setSequenceName(‘demo1_id_seq’); will be used for “demo1” table we i have used correct only for both the functions this is not the solution

oh ok. I will check it myself then and keep you updated. I hope I would be able to reproduce the issue.

hello,

now the grocery crud is working but when i add setRelation to function there is error nothing is displayed

Error: Internal Server Error.
Server Response:
The server returned an empty response (e.g. a blank page).

And when i remove the setRelation line from function the page displayes then what can be issue because we need setRelation in the function

Please let me know what to do?

Hello,

Can you please tell how to enable debug mode in grocery crud enterprise v3 so that i can get to know errors?

Hello @ondigit ,

I don’t understand what do you mean. “Debug mode” is always on. If you can’t see the error, this is a PHP configuration issue. Please check the stack overflow question here on how to show PHP errors: How do I get PHP errors to display? - Stack Overflow

hello,

Can you please reply for this below question also

now the grocery crud is working but when i add setRelation to function there is error nothing is displayed

Error: Internal Server Error.
Server Response:
The server returned an empty response (e.g. a blank page).

And when i remove the setRelation line from function the page displayes then what can be issue because we need setRelation in the function

Please let me know what to do?