Add PHP in getListQuery is very limiting and should be moved after all the tables join #547

Open
opened 2020-05-01 06:39:59 +00:00 by jcodewalker · 2 comments
jcodewalker commented 2020-05-01 06:39:59 +00:00 (Migrated from github.com)

Steps to reproduce the issue

In admin side, I need to join a table with a key field not present in the main table (which is always aliased as 'a'), but with a key field in a table joined by the model query anyway.
With the PHP custom block inserted just after the from table, and before all the join(s), we are not able to use any fields of tables that will be joined below because they are not known yet at this stage and we get a mySql error "unknown colum XYZ in ON clause..."

The custom PHP block should be moved after all the model select(s) and join(s) at least.
In this case we can use all the joined tables (and their fields) and even the clear method to refine the query if needed.

Inserted in the current position we can only interact with the main table with a custom PHP.

Expected result

Actual result

System information (as much as possible)

  • OS Name & Version:
  • MySql Version:
  • Apache Version:
  • PHP Version:
  • Joomla Version:
  • JCB Version:
  • Browser:

Additional comments

### Steps to reproduce the issue In admin side, I need to join a table with a key field not present in the main table (which is always aliased as 'a'), but with a key field in a table joined by the model query anyway. With the PHP custom block inserted just after the **from** table, and before all the join(s), we are not able to use any fields of tables that will be joined below because they are not known yet at this stage and we get a mySql error "_unknown colum XYZ in **ON** clause..._" The custom PHP block should be moved after all the model select(s) and join(s) at least. In this case we can use all the joined tables (and their fields) and even the **clear** method to refine the query if needed. Inserted in the current position we can only interact with the main table with a custom PHP. ### Expected result ### Actual result ### System information (as much as possible) - OS Name & Version: - MySql Version: - Apache Version: - PHP Version: - Joomla Version: - JCB Version: - Browser: ### Additional comments

There are different use cases here, and moving the field will break the implementation of other. I will take a look and see if we can add another field instead.

There are different use cases here, and moving the field will break the implementation of other. I will take a look and see if we can add another field instead.
jcodewalker commented 2020-05-02 12:59:59 +00:00 (Migrated from github.com)

Great!
Thank you!

Great! Thank you!
Llewellyn removed the
enhancement
label 2022-07-11 14:00:30 +00:00
Llewellyn added the
enhancement
label 2022-08-05 08:32:41 +00:00
Llewellyn added this to the Feature Requests project 2022-08-05 08:32:45 +00:00
Sign in to join this conversation.
No Milestone
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: joomla/Component-Builder#547
No description provided.