我正在为Moodle开发一个插件,并在我的Moodle安装中创建了一个项目。 我正在扩展一个名为block_base的类,但PhpStorm表示undefined class block_base 。 我的猜测是因为所有moodle文件(包括类block_base )都不在项目文件中。
如何将其添加到项目文件中? 我可以简单地让整个Moodle安装项目,但我不希望这样,因为我正在使用GitHub,然后我必须将所有Moodle文件放在那里,这是毫无意义的。
I'm developing a plugin for Moodle and created a project inside my Moodle installation. I'm extending a class called block_base but PhpStorm says undefined class block_base. My guess is that is because all the moodle files (including the class block_base) aren't in the project files.
How do I add this to the project files? I could just simply make the entire Moodle installation the project but I don't want that because i'm using GitHub and I then have to put all of the Moodle files on there as well and that is just pointless.
最满意答案
PHPStorm可以在一个项目中处理多个git根(这就是我管理插件的方式)。
所以,你可以做到以下几点:
查看主要Moodle回购的副本(来自git@github.com:moodle/moodle.git) 将您的插件(包括.git子目录)放在Moodle代码中的正确位置 将整个Moodle代码设置为PHPStorm的项目 转到文件>设置>版本控制 通常PHPStorm将(在对话框的底部)显示检测到的git根列表,您只需单击“添加根”即可。 如果没有,请单击右侧的“+”并添加插件的路径。现在,您可以对插件进行更改和更新,而无需检查Moodle的完整副本(作为额外的奖励,它可以很容易地获取最新的Moodle代码,因此您可以测试您的插件以防升级) 。
PHPStorm can handle multiple git roots within a single project (this is how I manage my plugins).
So, you can do the following:
Check out a copy of the main Moodle repo (from git@github.com:moodle/moodle.git) Put your plugin (including the .git subdirectory) in the correct place in the Moodle code Set the whole of the Moodle code as the project for PHPStorm Go to File > Settings > Version Control Usually PHPStorm will (at the bottom of the dialog) display a list of detected git roots and you can just click 'Add root'. If not, click on the '+' on the right and add the path for your plugin.Now, you can make changes to your plugin and update, without having to check in a full copy of Moodle (as an added bonus, it makes it nice and easy to pull the latest Moodle code, so you can test your plugin against upgrades).
更多推荐
发布评论