Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to generate PHP getters and setters in NetBeans?

I saw in NetBeans 8 refactoring functionality for automatic creation of getters and setters from class properties. It was working on Java code, but it seems that for PHP code it isn't working. Is it possible to enable this functionality or get some extension, which does that?

like image 960
Dreken Avatar asked Feb 20 '16 14:02

Dreken


People also ask

Can Netbeans generate getters and setters?

Position the cursor inside the class, then press ALT + Ins and select Getters and Setters from the contextual menu. – Aydin K.

Does PHP have getters and setters?

In this article, we learn the best way to create getter and setter strategies in PHP. Getter and setter strategies are utilized when we need to restrict the direct access to the variables by end-users. Getters and setters are methods used to define or retrieve the values of variables, normally private ones.


2 Answers

Just right click in side the class body,not over the class variables and choose insert code option as shown in third image. link:http://w.planetnetbeans.org/topic28565.html

getters and setters

generate option insert code option

like image 149
sunil Avatar answered Oct 06 '22 00:10

sunil


Place your cursor in the class, on the empty line and then hit ALT+Insert. You getter and setter options

like image 41
Siddarth Dubey Avatar answered Oct 06 '22 00:10

Siddarth Dubey