"Unable to resolve column" because the table name is in a variable.

My code structure looks like this:

Even if its not run through the function to get the table name $tbl, the select query always shows "Unable to resolve column".

I know I can turn off inspections completely, what I'm wondering is if there is a way instruct phpstorm as to what the correct table name I'm interested in is.

If I type the actual name into the place of {$tbl} then the connection all works.

I see there is an old issue from 2011 that seems very similar to this topic.  Any way to do this in 2019?

2 comments
Comment actions Permalink

Please map the schema for the file at File | Settings | Languages & Frameworks | SQL Resolution Scopes.

0
Comment actions Permalink

Each schema is defined by a module in its schema.php file.  They look like this:

 

Is there a way to export the schema from the database to give it to phpstorm in a structure that it understands?

-- edit --

I exported just the schema from the database and added in to
LANGUAGES & FRAMEWORKS -> SQL RESOLUTION SCOPES

Then chose the resolution scope of the project to match the file, but the in the queries in the code still the same error shows.

0

Please sign in to leave a comment.