PHP Editor Issue

PHP Editor Issue

sisawebsisaweb Posts: 1Questions: 0Answers: 0
edited April 2019 in Free community support

Good morning everyone,

I'm using the PHP Editor in order to simplify the request.

So this is the topic:
I have to check if the company has entered is data for the current month.

For that, I have two Postgres tables, one which containing all company, the other one all lines that the company have entering.

This is the request :

Editor::inst($db, 'company', 'id')
            ->fields(
                Field::inst('name')
            )
            ->join(
                Mjoin::inst('company_data', 'company_data.id')
                    ->link('company.id', 'company_data.company_id')
                    ->fields(
                        Field::inst('company_id', 'data_status')->set('false')
                    )
                    ->where(function ($q) {
                        $q->where('company_data.month', date('m'), '=');
                        $q->where('company_data.year', date('Y'), '=');
                    })
            )
            ->process($_POST)
            ->json();

But with the PHP Editor, that request throw an SQL Error. Because of the Where in the Mjoin,they have one space forgotten so the request give : WHERE month ... ANDcompany.id IN ...

To fix it , I update the file Database\Query.php by add a space on the line: 690
public function where_in ( $field, $arr, $operator="AND " )

Can you please update the repository depot, because I'm working with composer and I don't really like to update source file. It could be great if the DB connection will not set as default on composer. Because I'm using a framework and I would like to not create too DB configuration file.

Sorry, I'm french and my english isn't perfect.

Kind regards,

A.

Replies

This discussion has been closed.