Skip navigation

NetBeans Yii Plugin Requirements

Help

NetBeans Yii Plugin Requirements

Yii Framework Plugin

Hello, as you might already know the council members voted for creating an Yii framework plugin. But we don't have any experts on the framework, this is one of the reasons why we created this Frameworks Board group.

In this particular post I invite Yii experts to gather together and discuss the needed features for the plugin. These discussions than will be gathered and analyzed into a single specifications document. Following this document we'll try to make as much as we can to make a Yii developer happy.

Before I end I'd like you to keep in mind several questions and think about those :

  • Name 3 most needed things by a developer in your framework ?
  • Please enumerate some of the things that are not automated but should be ?
  • Let's discuss some basic development workflow, what are the most often executed actions ?

Thank you, I wait for your opinions.

I think the most important

I think the most important things were mentioned, but to reiterate, what I'd most like to see: 1. Autocomplete for $this-> and modules 2. New App generation 3. File Navigation - as roderigo suggests 4. Easy access and editing of Views - autocompletion for view varialbes, navigate to relevant view based on render() or path

Petra Novandi Barus from FB

Petra Novandi Barus from FB Yii group says:

I just want to add example for the autocompletion especially about CWebApplication component injection. Although I'm still not sure enough if this is important enough to be in the new Yii NB Plugin.

The nice thing I like about Yii is that I can easily add component in the CWebApplication from the config (/protected/config/main.php. this is the default config file for production)

e.g.

<?php
//CONFIG #1
return array(
 //cut
  'components' => array(
    'user' => array(
      'allowAutoLogin' => true,
    )
  )
 //cut
);

the current Netbeans can detect the App singleton in Yii class, although it only detects the singleton as CApplication instead of CWebApplication (if I code it for the web endpoint not console).

It will be nice if the NB can do autocomplete for the 'component' config.

Let's say if I had the config #1 above, and I type Yii::app()->us it can complete to Yii::app()->user and knows that Yii::app()->user is the default CWebUser (see [1] and [2])

And what's really nice about the component part in the config, I can change the class for user component.

<?php
//CONFIG #2
return array(
 //cut
  'components' => array(
    'user' => array(
      'class' => 'MyWebUser',
      'allowAutoLogin' => true,
    )
  )
 //cut
);

So, if I type Yii::app()->user, it would be nice if NetBeans could know if the user field is an instance of MyWebUser.

Another thing is, as I mentioned above, that I can add custom component to Yii::app() singleton.

<?php
//CONFIG #3
return array(
 //cut
  'components' => array(
    'myComponent' => array(
      'class' => 'MyComponentClass',
    )
  )
 //cut
);

This is not the default CWebApplication components as stated in [1], but this is what I really like from Yii. I can just call my component by Yii::app()->myComponent. And it would be nice if NetBeans could know if the myComponent is an instance of MyComponentClass.

Again, I'm not sure if it's important enough for everyone else and I'm already getting used to it. But I'm just suggesting. :)

[1] http://www.yiiframework.com/doc/api/1.1/CWebApplication [2] https://github.com/yiisoft/yii/blob/1.1.12/framework/web/CWebApplication...

Most needed things by a

Most needed things by a developer in Yii framework

Autocompletion: Yii is very modular, that's why sometimes the IDE can't find the class returned by some method calls (or its magic counterparts). This happens, for example, in calls to CModule::getModule, usually done via Yii::app()->getModule('moduleName');.

Things that are not automated but should be

  1. Generate the app. It is easy to do manually, but still has the potential to get beginners up and running quicker.
  2. Create files automatically (for example, when a view is referenced in a render method call).

The most often executed actions

I believe that, after the use of autocompletion, navigation between files is the most often executed task. The control-click feature is very useful, but views are referenced inside of strings and it doesn't wotk there currently. This can be the first step in improving the navigation.

Opening files is another frequent operation. The "Go to File" dialog is very useful, but it gets polluted with the framework files (usually not what the user is looking for) and is difficult to distinguish files with the same name (very common for views, less common for controllers like the DefaultController). Some type of context could be added to this dialog: where is the file from (app, framework, vendor/lib), and an intra-app context could be applied, too (show the module/component/extension names). The files could be segregated in tabs for the app files, the framework files and custom directories for vendor/lib etc.

All good points from Alexander, especially the abiltiy to navigate to the view.

Congratulations and thanks for your initiative, guys!

Thank you Rodrigo for your

Thank you Rodrigo for your valuable comments

Existing IDEs with Yii

Existing IDEs with Yii support:

http://www.codelobster.com/yii.html (haven't reviewed it). http://yiiclipse.maziarz.org/ (navigation and completion are good).

A guide to setting up NetBeans for Yii (maybe some things could be automated):

http://www.yiiframework.com/wiki/83/netbeans-ide-and-yii-projects/

Discussion in PhpStorm tracker (they've started MVC thing already):

http://youtrack.jetbrains.com/issue/WI-322

Very good Alexander, we'll

Very good Alexander, we'll analyze the links you sent us.

Autocomplete for "$this" in

  1. Autocomplete for "$this" in views.
  2. When using Post::model()-> IDE should assume Post class as return type instead of CActiveRecord.
  3. Autocomplete for behaviors.
  4. Abiltiy to navigate to the view from $this->render('x') or $this->renderPartial('x').
Frameworks Board
Need help?

Blog

The blog lets your team communicate by posting updates and discussing issues. It is a great place for sharing progress, discussing challenges, and exploring ideas.