How to resolve prefixed SQL table in PhpStorm?

I am working on PhpStorm to develop my Prestashop sites and I cannot solve this problem. I work on localhost and successfully connected PhpStorm to my MySQL server.

Now PhpStorm generates warnings like “cannot resolve table '$ {_ DB_PREFIX_} cms'”. Prestashop uses prefixes for table names, and it seems that PhpStorm cannot resolve these tables with prefixes.

Is there a workaround for this?

Here is an example from Prestashop-1.6 sources:

$sql = 'SELECT c.`id_cms`, cl.`meta_title`, cl.`link_rewrite`
    FROM `'._DB_PREFIX_.'cms` c
    INNER JOIN `'._DB_PREFIX_.'cms_shop` cs
    ON (c.`id_cms` = cs.`id_cms`)
    INNER JOIN `'._DB_PREFIX_.'cms_lang` cl
    ON (c.`id_cms` = cl.`id_cms`)
    WHERE c.`id_cms_category` = '.(int)$id_cms_category.'
    AND cs.`id_shop` = '.(int)$id_shop.'
    AND cl.`id_lang` = '.(int)$id_lang.
    $where_shop.'
    AND c.`active` = 1
    ORDER BY `position`';

Error in PhpStorm for mysql tables with prefixes

+4
source share
2 answers

There really is no way to handle this. But you can disable the check for such a warning.

  • File > Settings > Editor > Inspections
  • SQL
  • Unresolved reference
+1

, , , , , , information_schema.*

, .

Data Sources and Drivers, General, Schemas information_schema.* .

"Apply" "okay", PhpStorm , , .

+10

Source: https://habr.com/ru/post/1623068/


All Articles