Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to Resolve Symbol on SQL code (PhpStorm issue)

Tags:

phpstorm

I am using PhpStorm 2016.1.2 and have been comfortably using PhpStorm for a couple of years. I have my Storm set up with the Database connection and displaying the MySQL database that my PHP pages connect to. The SQL is usually written within the PHP page in custom functions via a database connection class.

An example code chunk:

$checkData = $dataBaseSecure->getSelect(
"SELECT check_login.fail_id, UNIX_TIMESTAMP(check_login.last_action) AS timer
FROM check_login WHERE check_login.ip_addr = ? AND check_login.check_drop = ? ",
 $data, TRUE);  

Don't worry about the database PHP wrapper, this style and layout of SQL in PHP has been around on my work for a couple of years, in PhpStorm and works completely and accurately on the server and on all testings.

As Of Yesterday (17th June 2016)

I don't know what's changed but suddenly PhpStorm is now telling me, on all my SQL strings, across all my Projects:

Unable to resolve symbol '<table name>'

or

Unable to resolve column '<column name>'

And also (due to this) PhpStorm no longer carries out any auto-complete or organisation functions as I work on my SQL code.

Solutions I've tried

  • I have already tried to invalidate and revalidate my caches based on this answer to a similar question. But that hasn't helped.

  • I have very carefully explored my settings but the PhpStorm Database tab successfully connects to the database, and as far as I'm aware I made no changes to cause this change in behaviour.

  • I have looked over the various (and many) settings in PhpStorm preferences but seen nothing that has shone any light on this issue, or the changes I have tweaked have not resolved it.

  • I have found this answer but this does not seem to apply as my table names are not variables. I have also found this post, which while dated 2014 shows a similar issue but not a suitable solution.

    • I only have one database connection in most projects, but the number of databases doesn't seem to effect if this issue occurs.
  • Fully escaping SQL queries with appropriate backticks around named entities does not resolve the issue.

  • I have correctly configured my SQL dialect to the correct MySQL.

  • Reading related posts I'm found on Stack Overflow has provided no useful information.


I have no plugins in PhpStorm that relate to this issue or PHP/MySQL interaction.

If you have any ideas how to resolve this please tell me. If you have specific preferences you'd like me to check please let me know and I can add them into the question, (there are so many preferences in PhpStorm I won't post them all here right now, as I'm sure most are not related to this issue).

The Key is that this system was working perfectly two days ago!!!

like image 872
Martin Avatar asked Jun 18 '16 11:06

Martin


1 Answers

Please try re-synchronizing your DB schemas -- just in case if it somehow got corrupted or invalid.

If it did not give any visual results -- try more radical version of it:

  • close IDE
  • open .idea subfolder for this project (the place where this project settings are stored)
  • delete dataSources.ids file
  • re-open project in IDE
  • re-sync DB structure / re-create DB connection from scratch.
like image 115
LazyOne Avatar answered Sep 30 '22 01:09

LazyOne