views:

24

answers:

2

Example:

protected $_labelName = null;

Should generate

public function getLabelName()
{
    $this->_labelName;
}

public function setLabelName($labelName)
{
    $this->_labelName = $labelName;
    return $this;
}

But it is generates

public function get_labelName()
{
    return $this->_labelName;
}

public function set_labelName($_labelName)
{
    $this->_labelName = $_labelName;
    return $this;
}

As you could see - it looks different but i didn't found the way how to change the method name and to trim the set method param name.

A: 

You can change the method body (and comment) by clicking

Window > Preferences > PHP > Editor > Templates

I don't think you can change the method signature though. I'll open a ticket with Zend and ask for a way to change it. It's kinda annoying that the premier IDE for Zend Framework generates getters and setters that are not in compliance with the ZF code convention.

Gordon
That is because you don't follow the ZF naming conventions for variables : `As with function names (see section 3.3) variable names must always start with a lowercase letter and follow the "camelCaps" capitalization convention.` (http://framework.zend.com/manual/en/coding-standard.naming-conventions.html)
wimvds
@wimvds read the whole chapter please :) we're talking about instance variables.
Gordon
Oops, indeed, mea culpa. The workaround I posted does work however, so you could use that until they fix it.
wimvds
@wimvds no problem. unfortunately your approach is indeed the only way right now.
Gordon
A: 

A simple workaround : name your var $labelName, then generate getters and setters, and finally refactor/rename the var so it becomes $_labelName. Works in Zend Studio 7.2 (just downloaded the trial to check it :p).

wimvds