为SQL参数提供占位符值

The Problem:

I am using a framework which at many points provides queries just like this one:

$sql = "select $sArticleTable.* from table_A left join " .
       "$sArticleTable on table_A.objectid=$sArticleTable.id " .
       "where table_A.articlenid = $sArticleId " .
       "and $sArticleTable.id is not null and " . $object->someMoreSQL() .
       "order by table_A.sort";

As you can see, one table name gets inserted via the $sArticleTable variable. Even though I highly detest this way of writing up an MySQL statement, there is nothing right now I can do about it.

This way of writing up the statement prevents PhpStorm from recognizing the table name correctly, so no autocomplete suggestions are being shown.

How can I give PhpStorm a placeholder value for the variable $sArticleTable so that it will in turn again provide autocomplete suggestions?

I have tried Database -> User Parameters in the settings, but I do not get prompted to enter a placeholder value.

I also know that I could simply replace the variable with the correct table name, adjust the SQL and then re-enter the variable. But this seems rather unprofessional, given that I think PhpStorm might provide the solution here.

Furthermore, since I am already adjusting the SQL, I could very well rewrite the statement in a more fitting way. Which, with a relatively small statement such as this, I might end up doing. There are however much larger statements that would eat up way to much time to rewrite.

ATM there is no way of doing that. I could be wrong here ... but it might only be supported for Joomla in latest 2017.2 version (considering their specific syntax) .. but no other generic way (it applies to both table name or table name prefix).

Here are some related tickets on this subject -- watch them (star/vote/comment) to get notified on any progress:


P.S. If you do not like SQL errors like these (the fact that IDE shows them) then you can tell IDE to treat this string as plain text (so no SQL colors/errors) -- place /** @lang Text */ just before the string opening quotes.