XF 2.3 PhpStorm / Other IDE / XF Development

frm

Well-known member
I've been editing in an editor that can recognize previously used variables and also autocompletes the PHP functions that I use.

That said, I have a few questions on PhpStorm or other IDEs that may make developing for me a bit easier.

The first is saving an update: Does this update the addon.json version id with a new string (be it beta or a 3rd point) so that it can be upgraded via the ACP, or am I stuck uninstalling and reinstalling nonetheless?

Secondly, with these "helpers" I've been reading about.
If I set $forum as something like this:
PHP:
$forum = \XF::finder('XF:Forum')->where('node_id', $this->nodeId)->fetchOne();

Would it autocomplete $forum->last to show other suggestions like $forum->last_post_date, $forum->last_post_username, $forum->last_thread_title... for me to choose from?

And lastly, if I use use XF\Job\AbstractJob;, will it create a new file and place it in the "Job" folder?

More importantly, would it export from the "upload" root directory with all the files created?

The version id, having to uninstall/reinstall as opposed to a seamless upgrade slows me down, and having it place the appropriate files in the right file tree would help more, but exporting it as an installable zip would be the cream of the crop.

I'm open to PhpStorm or any other IDE that can "compile" (loosely used, or create and arrange the files appropriately for what is being called) and make it upgradeable by changing the version id string.
 
The first is saving an update: Does this update the addon.json version id with a new string (be it beta or a 3rd point) so that it can be upgraded via the ACP, or am I stuck uninstalling and reinstalling nonetheless?
You don’t need to uninstall/install.
You can modify he addon json and sync it in admincp in addons list after.

Also if you need you have CLI commands, check the development documentation that is provided.
Secondly, with these "helpers" I've been reading about.
If I set $forum as something like this:
PHP:
$forum = \XF::finder('XF:Forum')->where('node_id', $this->nodeId)->fetchOne();

Would it autocomplete $forum->last to show other suggestions like $forum->last_post_date, $forum->last_post_username, $forum->last_thread_title... for me to choose from?
Yes in phpstorm for example.
And lastly, if I use use XF\Job\AbstractJob;, will it create a new file and place it in the "Job" folder?
What do you mean ? It does not auto create files, you choose where you create them.
More importantly, would it export from the "upload" root directory with all the files created.
If you use the build cli command yes.
As said above check the document.
The version id, having to uninstall/reinstall as opposed to a seamless upgrade slows me down, and having it place the appropriate files in the right file tree would help more, but exporting it as an installable zip would be the cream of the crop.

I'm open to PhpStorm or any other IDE that can "compile" (loosely used, or create and arrange the files appropriately for what is being called) and make it upgradeable by changing the version id string.
I use Phpstorm personally.
 
  • Like
Reactions: frm
What do you mean ? It does not auto create files, you choose where you create them.
So, essentially follow the best practices of creating the file trees that all add ons seem to use when calling \Job\ for instance and create the new file there (/Job/), or does it even matter, and is it more for organizing larger add ons?
 
You need to keep the folder accurate if it’s not overloading of existing files otherwise it won’t work.

Typically when you call $this->app->service() for example, you don’t input the folder name xf knows where to search when you input the parameter.
 
  • Like
Reactions: frm
The directory structure is still important but in XF 2.3 beyond we recommend using class strings instead of short-names:

PHP:
$forum = \XF::finder(\XF\Finder\ForumFinder::class)->where('node_id', $this->nodeId)->fetchOne();

// ... or ...

use XF\Finder\ForumFinder;

$forum = \XF::finder(ForumFinder::class)->where('node_id', $this->nodeId)->fetchOne();
 
  • Like
Reactions: frm
Back
Top Bottom