有没有一种方法或插件可以在PhpStorm中将SQL方言配置为DQL? [英] Is there a way or a plugin to configure SQL Dialects as DQL in PhpStorm?

查看:249
本文介绍了有没有一种方法或插件可以在PhpStorm中将SQL方言配置为DQL?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在PhpStorm中,我可以使用现有的SQL方言更改全局,项目或目录设置,但是有一种方法可以在PhpStorm中将SQL方言配置为Symfony/DQL,也可以通过一种方法来检测App:Panel是有效实体,而不是一张桌子? ( App:Panel表名称为te_panel )

In PhpStorm, I can change global, project or directories settings with existing SQL Dialects, but is there a way to configure SQL Dialects as Symfony/DQL in PhpStorm or a way to detect that App:Panel is a valid entity, not a table? (App:Panel table name is te_panel)

我阅读了此 answer ,它说明我们必须添加Java插件,因为它是目前无法在PhpStorm上添加新的SQL方言.

I read this answer which explains that we have to add a Java plugin, because it's currently not possible to add a new SQL Dialect on PhpStorm.

例如,这是PhpStorm引发的错误:

As example, this is an error that PhpStorm is throwing:

无法理解App和Panel之间的:.它无法理解所提供的表名(因为我提供了Symfony实体的名称).

The : between App and Panel is not understood. It cannot understand the table name provided (because I provide the name of the Symfony entity).

推荐答案

不支持DQL.

https://youtrack.jetbrains.com/issue/WI-9948 -观看此票(星号/投票/评论)以获取有关任何进度的通知.

https://youtrack.jetbrains.com/issue/WI-9948 -- watch this ticket (star/vote/comment) to get notified on any progress.

您可以尝试将App:Panel视为占位符(类似于该链接问题中的描述).但是我不知道它是否会有所帮助(尚未与Symfony/DQL一起使用,因此无法自己对其进行测试).

You may try and treat App:Panel as placeholder (similar to how it was described in that linked question). But I have no ideas if it will help (have not really worked with Symfony/DQL so cannot test it myself).

我可能会建议-威胁整个查询为纯文本.是的,没有语法突出显示和填充,但是也不会显示错误.

What I may suggest though -- threat the whole query as plain text. Yes, no syntax highlighting and stuff but will not show errors either.

如何?一种通过在字符串之前放置特殊注释的方式,例如

How? One way by placing special comment just before the string, e.g.

->query(/** @lang text */'SELECT ...');

或者通过完全禁用SQL的语言注入规则.

Or by disabling Language Injection rule for SQL altogether.

或者尝试在此评论中 -自定义SQL检测语法(?): https://gist.github.com/willemnviljoen/d20ad8ad0cc365a7e80744328246610f

Alternatively try what has been suggested in this comment -- custom SQL detection syntax(?): https://gist.github.com/willemnviljoen/d20ad8ad0cc365a7e80744328246610f

这篇关于有没有一种方法或插件可以在PhpStorm中将SQL方言配置为DQL?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆