douyue3800 2012-04-02 09:26
浏览 64
已采纳

Netbeans:改变php模块中getter / setter生成行为的可能性

Greetings programmers,

I was wondering if there is a possibility to change the behaviour of getter/setter generation in php module. At the moment it works like this:

class A
{
    private $field;
}

Now I will generate setter by pressing alt+ins and selecting "Setter..." resulting in:

class A
{
    private $field;

    public function setField($field)
    {
         $this->field = $field;
    }
}

Is there a possibility to change the behaviour that it would generate something differnet, lets say this:

class A
{
    private $field;

    public function setField($field)
    {
         $this->field = $field;
         return $this;
    }
}

The difference is at the returh $this row.

  • 写回答

1条回答 默认 最新

  • doukuiqian5345 2012-10-17 15:01
    关注

    I ran into this old question while searching for ways to adjust the template used for setter/getter generation in netbeans.

    Since this question is left unanswered, ill leave a pointer to a similar question: How to edit getter & setter templates in NetBeans?

    Basically the answer is: No, you can not change the template of the setter/getter generator in netbeans. Atleast not unless you are willing to patch the Netbeans sourcecode.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?