Support for Moodle SQL statements

This is a bit of a long-shot, but here goes ...

Moodle ( ) code is configured with database prefixes to allow for the database tables to sit alongside other projects (possibly other Moodle installs) within a single database.

So, by default, all tables start 'mdl_' (e.g. mdl_course, mdl_user, etc.)

You used to have to write SQL statements as 'SELECT * FROM '.$CFG->prefix.'course', but in recent versions of Moodle you can now write 'SELECT * FROM {course}' and the Moodle code will automatically insert the prefix for you (although there are also a whole load of helper functions that avoid having to write SQL statements directly, to improve cross-engine database compatibility).

Unfortunately (and understandably), PHPStorm does not understand this {tablename} syntax and so all the features related to connecting PHPStorm to the database are lost. I there any way that PHPStorm can be configured to understand these references? (Or would it be easy to create a plugin that would bridge that functionality?)


Please sign in to leave a comment.