post by ondigit on Jul 14, 2023

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

post by johnny on Jul 15, 2023

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

post by ondigit on Jul 17, 2023

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

post by johnny on Jul 17, 2023

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);
}

post by ondigit on Jul 17, 2023

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

post by johnny on Jul 17, 2023

post by ondigit on Jul 17, 2023

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] (https://stackoverflow.com/questions/7985730/currval-function-in-postgresql-complaining-that-column-does-not-exist) == this solution whch is provided in the email is not working i checked it.

Thank you

post by johnny on Jul 17, 2023

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

post by ondigit on Jul 17, 2023

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

post by johnny on Jul 17, 2023

post by ondigit on Jul 17, 2023

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

post by johnny on Jul 17, 2023

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');

post by ondigit on Jul 17, 2023

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,

post by webjohnny on Jul 17, 2023

Hello @ondigit

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

$crud->setSequenceName('demo_id_seq');

post by ondigit on Jul 18, 2023

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

post by johnny on Jul 18, 2023

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

post by ondigit on Jul 21, 2023

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?

post by ondigit on Jul 21, 2023

Hello,

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

post by johnny on Jul 25, 2023

post by ondigit on Jul 25, 2023

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?

1 / 26
Jul 2023