What is Toluu?
Toluu is a free service for sharing the feeds you read and discovering new ones.
Get Invite

NetBeans for PHP


Defining a variable type in comment IIYesterday

In the previous post I wrote about the new feature, which is requested by many people. In this entry I will write little more about this feature.

I wrote that the comment has to have a defined form. NetBeans can help you with writing it. There is registered new code template, which has the default abreviation vdoc. So when you write vdoc and press TAB key the letters vdoc are replaced with the comment template. The variable name is selected and you can change it. Then you can press TAB again and the type is selected.

varDoc04.png

As you can see the code completion works for both - variables and types.

varDoc05.png

This code template is smart:). If there is used a variable after the place, where you writing the template, then is the name of the variable suggested by default. If there is not any variable used after the place, where you are using the template, then the name of variable above is suggested as default. If NetBeans are not able locate any variable near to the line, where you are using the template, then as the default name is suggested variable



Defining a variable type in commentJanuary 6

Yesterday was the first day at work this year and we committed new feature, which allow to define a type for a variable in a comment. The comment has to be defined in specific form as is displayed on the picture.

varDoc01.png

The comment has to be /* @var $variable type */ . If the comment is written in the right form, then the var tag has bold font.

You can use this helper, when NetBeans is not able to recognize the type of the variable. On the picture below you can see that NetBeans recognizes that the variable $media in the echo statement is Book type. But then another object is assigned to the $media variable through the getLastMovie() function. This function defines the return type Movie, so from this line NetBeans knows that $media variable contains an object of Movie type. 

varDoc02.png

NetBeans handles the variable name and the type from the comment helper as are handled in PHP Doc. So for example mark occurrences works as usual.

varDoc03.png

Next time I will show you how NetBeans can help you with writing the comment helper.




Merry Christmas and Happy New YearDecember 23 2008

I would like to wish everyone a Merry Christmas and Happy New Year.



Marking occurrences improvedDecember 18 2008

Mark occurrences is not a new feature, but the trunk contains some improvements in this area. In the source the feature highlights in the elements which is under the cursor position. You can also easily move between marked occurrences through ALT + UP and ALT + DOWN shortcuts.

I'm going to show you some differences. On the pictures there is on the left side screenshot of NetBeans 6.5 and on the right side screenshot of the same source, but from NetBeans 7.0 development build.

Class fields are also marked in the PHP doc.

markoccurrencies01.png

Parameters of a function or a method are also marked in the PHP doc.

markoccurrencies02.png

Types are marked in the PHP doc as well.

markoccurrencies03.png

NetBeans are now able to mark the same methods in  method chains.

markoccurrencies04.png




SQL code completion in the PHP editorDecember 16 2008

The feature, which I want to introduce today, offers code completion for SQL select statements in the PHP editor. The SQL code completion is offered when the edited string starts with select SQL keyword.

On the first picture you can see that the SQL code completion offers only one item Select Database Connection ... . It's because is not clear which db connection should be used.

sqlcc01.png

When you select the item, a simple dialog for selecting  a database connection is opened. The dialog offers connections, which are already registered in the Services tab or you can create new connection. 

sqlcc02.png

After selecting the connection the SQL code completion offers all tables from selected db connection. 

sqlcc03.png

sqlcc04.png

The code completion offers columns if there known tables that are used in the select statement.  As you can see from the last picture, the code completion is able also to work with table aliases.